Bugs in OS9/68K C-Compiler ?
Guy Harris
guy at auspex.UUCP
Fri Oct 28 14:23:02 AEST 1988
>For the 'return 0 != ptr' problem : I don't know why, but 'return ptr != 0'
>works. Apparently the compiler automatically casts integers to pointers
>on comparisons but doesn't cast pointers to integers. I don't know what
>K&R says to this case.
K&R say that both
0 != ptr
and
ptr != 0
should cause 0 to be cast to the type of the pointer "ptr". It should
not cast "ptr" to "int" in *either* case.
More information about the Comp.lang.c
mailing list