bug or beer?

Everything else that doesn't fall into one of the other PB categories.
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

bug or beer?

Post 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
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8452
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

BERESHEIT
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

Post by NoahPhense »

Hey net.. That's kewl and all. But then it IS a bug in PB, right?

- np
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8452
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post 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!
BERESHEIT
Post Reply