pointer checking
martin
martin at littlei.UUCP
Wed Feb 17 04:29:18 AEST 1988
I do not want to start another net wars, but I am tired of seeing
people write programs that are non-portable between C compilers.
The material I am referencing is the latest software called "perl".
If you look at the source you will see that the authors blatenly
compaired pointers to zero without thinking what happens if
sizeof(ptr) != sizeof(int). I know that C does not gripe if
you do something like this, but can't people program better?
Example:
char *ptr;
if (ptr) { /* WRONG !!!!!! */
do something
}
if (ptr != (char *)NULL) { /* RIGHT !!!!!! */
do something
}
If you want people to use your software, then write it so that
it can be ported easier.
Standard disclaimer applies.
More information about the Comp.sources.bugs
mailing list