QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: SMcNeill on August 27, 2019, 10:36:15 am

Title: A _STRICMP glitch
Post by: SMcNeill on August 27, 2019, 10:36:15 am
Code: QB64: [Select]
  1. PRINT _STRICMP("airy", "air")
  2. PRINT _STRICMP("air", "airy")

The first claims they're equal; the second knows they're not...  There's a slight glitch in the routine somewhere, and I thought I'd mention it so folks would be aware of it.  ;)
Title: Re: A _STRICMP glitch
Post by: SMcNeill on August 27, 2019, 10:57:20 am
The glitch for this is down in libqb.cpp...

Code: [Select]
    if (l1<l2) return -1;
    if (l2>l1) return 1;
    return 0;

IF l1 is less than l2, then l2 is going to be greater than l1....  The comparison values got reversed with the second IF there, so they do nothing.  :P