Page 1 of 1

bug or beer?

Posted: Tue Aug 29, 2006 3:57 am
by NoahPhense
Not sure if this is a bug. Had a few beers, it's late, and I'm tired. But
what the heck.

Just copied this from the help file. Worked great, until I limited the length
of that string Name${10}.

Again, my logic is sleeping right now. But my finger aren't.

Don't get me wrong, I know how to fix it, I'm just wondering if by default
this would be a bug, or user error. :)

- np

Code: Select all

 Structure Animal
    Name${10}
    Speed.l
  EndStructure
  
  Dim Animals.Animal(2)
  
  Animals(0)\Name$ = "Tiger"
  Animals(0)\Speed = 10
  
  Animals(1)\Name$ = "Jaguar"
  Animals(1)\Speed = 40
  
  Animals(2)\Name$ = "Zebre"
  Animals(2)\Speed = 30
  
  ; Sort the array on the 'name$' field, which is a string
  ;
  SortStructuredArray(Animals(), 0, OffsetOf(Animal\Name$), #PB_Sort_String)
  
  For k=0 To 2
    Debug Animals(k)\Name$+" - Speed: "+Str(Animals(k)\Speed)
  Next
  
  ; Sort the array on the 'speed' field, which is a long
  ;
  SortStructuredArray(Animals(), 0, OffsetOf(Animal\Speed), #PB_Sort_Long)
  
  For k=0 To 2
    Debug Animals(k)\Name$+" - Speed: "+Str(Animals(k)\Speed)
  Next

Posted: Tue Aug 29, 2006 4:29 am
by netmaestro

Posted: Thu Aug 31, 2006 2:23 am
by NoahPhense
Hey net.. That's kewl and all. But then it IS a bug in PB, right?

- np

Posted: Thu Aug 31, 2006 3:07 am
by netmaestro
It's not so much a bug as it just didn't get implemented for PB 4.0. I'm sure it's high on the todo list as it can't be too hard for Fred to write. If I can do it, he certainly can manage it!