Re:C Strings and my slow descent to madness
by skywal_l on Thursday April 06, 2023 @03:55PM
(#35473517)
https://developer.apple.com/library/archive/documentation/Sy...
[ Parent
| on HN ]
Re:C Strings and my slow descent to madness
by cpeterso on Thursday April 06, 2023 @05:42PM
(#35474920)
strcmp's return value is loosely defined because some implementations return the difference between the characters in the string to avoid some conditional checks or jumps. Something like:
int d = a[i] - b[i];
if (d == 0) return d;