pointer checking
Root Boy Jim
rbj at icst-cmr.arpa
Thu Feb 18 07:44:50 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.
You had better go check your facts, because you are dead wrong.
The material I am referencing is the latest software called "perl".
Larry Wall, the author, takes great pains to allow his software to
run in incredibly diverse environments. Look at the configure script.
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
}
YOU are wrong. This has always been allowed.
if (ptr != (char *)NULL) { /* RIGHT !!!!!! */
do something
}
Also correct, altho the cast is really not needed.
If you want people to use your software, then write it so that
it can be ported easier.
Does your compiler barf? If so, it is incorrect.
Standard disclaimer applies.
(Root Boy) Jim Cottrell <rbj at icst-cmr.arpa>
National Bureau of Standards
Flamer's Hotline: (301) 975-5688
I'm into SOFTWARE!
More information about the Comp.sources.bugs
mailing list