home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!crdgw1!rpi!uwm.edu!spool.mu.edu!agate!doc.ic.ac.uk!pipex!demon!trmphrst.demon.co.uk!nikki
- From: nikki@trmphrst.demon.co.uk (Nikki Locke)
- Newsgroups: comp.lang.c++
- Subject: Re: Is (p) instead of (p!=NULL) portable?
- Message-ID: <728160328snx@trmphrst.demon.co.uk>
- Date: 27 Jan 93 11:45:28 GMT
- References: <1993Jan25.125627.29030@ugle.unit.no>
- Sender: usenet@demon.co.uk
- Reply-To: nikki@trmphrst.demon.co.uk
- Organization: Trumphurst Ltd.
- Lines: 16
- X-Mailer: cppnews $Revision: 1.31 $
-
- In article <1993Jan25.125627.29030@ugle.unit.no> robert@alkymi.unit.no (Robert Schmidt) writes:
- >
- > In PC C's, the NULL pointer is defined with a bit pattern of all zero's,
- > and the constructs
- > if (p)
- > and
- > if (!p)
- > checks for NULL and non-NULL respectively. Is this portable to *all*
- > platforms?
-
- Yes. Even if a NULL pointer does NOT have a bit pattern of all zeroes, the
- above is still guaranteed to work.
-
- --
- Nikki Locke,Trumphurst Ltd.(PC and Unix consultancy) nikki@trmphrst.demon.co.uk
- trmphrst.demon.co.uk is NOT affiliated with ANY other sites at demon.co.uk.
-