Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!usc!apple!motcsd!hpda!hpcuhb!hpcllla!hpclisp!hpclwjm!walter From: walter@hpclwjm.HP.COM (Walter Murray) Newsgroups: comp.lang.c Subject: Re: Re: use of if (!cptr) and if (cptr), where cptr is a *) Message-ID: <660046@hpclwjm.HP.COM> Date: 26 Jul 89 16:44:37 GMT References: <10099@mpx2.mpx.com> Organization: Hewlett-Packard Calif. Language Lab Lines: 17 Jeff Leyser writes: > OK, this may be meaningless, but out of curiosity is: > if (cptr == (int) 0) > illegal C, or simply compleat garbage? It's perfectly legal, if a little misleading. As a further examle of the latitude you have in writing a null pointer constant, the following would also be legal. if (cptr == (signed short)0.3+sizeof(char)-'\1' +sizeof((long int*)myfunc()+3,000)-sizeof'M'); I think any ANSI-conforming compiler will accept this statement. Walter Murray Not speaking for Hewlett-Packard or X3J11