Posted Dec 23, 2003 3:08 UTC (Tue) by tres (guest, #352)
[Link]
This fails to take into account the possibility of some SCO programmer doing:
char new_char = toupper( '5' );
It also fails to work on non ASCII codes which Linus' might or might not depending on whether or not lower case letters have a larger numerical representation.
Linus Torvalds on SCO's latest claims
Posted Dec 23, 2003 6:38 UTC (Tue) by proski (subscriber, #104)
[Link]
Try this with your definition:
#include <stdio.h>
int main() {
printf("Should be A, actually %c\n", toupper(1 ? 'a' : 'b'));
}
$ ./test
Should be A, actually a
Linus Torvalds on SCO's latest claims
Posted Dec 23, 2003 9:42 UTC (Tue) by dvrabel (subscriber, #9500)
[Link]
You're missing brackets around the argument in the body of the macro. This is why I always use inline functions in preference to macros.