Author Topic: INSTR buggy wuggy  (Read 1032 times)


  • Guest
INSTR buggy wuggy
« on: 2011-Jan-05 »
For some reason, the following :

Code: (glbasic) [Select]

returns 0  :blink:

The only thing I can think is that INSTR performs character by character comparison which stops as soon as the first character has been correctly compared, instead of comparing whole text

Offline Moru

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1787
    • View Profile
    • Homepage
Re: INSTR buggy wuggy
« Reply #1 on: 2011-Jan-05 »
Yes very funny, if you insert a space at the start before Spots, it will return -1 as it's supposed to do.

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10745
  • here on my island the sea says 'hello'
    • View Profile
Re: INSTR buggy wuggy
« Reply #2 on: 2011-Jan-05 »
I'm so sorry! Must have been horror to find.
When the length of both strings equal, I call a different function, that compares the strings 4 bytes at once (as far as there are more than 4 bytes to compare, left). In that function I use an int32 pointer instead of the char pointer to compare. BUT! I compared the char pointers here (typo I guess).
I fixed it in the next update.