Author Topic: A _STRICMP glitch  (Read 2666 times)

0 Members and 1 Guest are viewing this topic.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
A _STRICMP glitch
« 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.  ;)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: A _STRICMP glitch
« Reply #1 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
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!