home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!spool.mu.edu!uwm.edu!linac!att!cbnewse!cbnewsd!att-out!cbfsb!cbnewsg.cb.att.com!nh
- From: nh@cbnewsg.cb.att.com (nicholas.hounsome)
- Subject: Re: Is (p) instead of (p!=NULL) portable?
- Message-ID: <1993Jan26.091708.11214@cbfsb.cb.att.com>
- Sender: news@cbfsb.cb.att.com
- Organization: AT&T
- References: <1993Jan25.125627.29030@ugle.unit.no>
- Date: Tue, 26 Jan 1993 09:17:08 GMT
- Lines: 23
-
- From article <1993Jan25.125627.29030@ugle.unit.no>, by robert@alkymi.unit.no (Robert Schmidt):
- >
- > 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?
- >
- >
- > Robert
-
- It is NOT portable for C.
- It is portable for C++ which is the group that you have posted to -
- did you mean to?
-
- #define NULL (void*)0
- if(p==NULL)
-
- This is WRONG in C++ and right in C.
- (char*)0 is even worse in C++.
-
-