Path: utzoo!attcan!uunet!wash08!rae98
From: rae98@wash08.UUCP (Robert A. Earl)
Newsgroups: comp.lang.c
Subject: Re: "do ... while ((NULL + 1) - 1);" -- valid C?
Message-ID: <625@wash08.UUCP>
Date: 10 Aug 89 13:27:17 GMT
References: <1043@levels.sait.edu.au> <961@virtech.UUCP> <10684@smoke.BRL.MIL> <696@ftp.COM>
Reply-To: rae98@wash08.UUCP (Robert A. Earl)
Organization: American Chemical Society, Washington, DC
Lines: 22

In article <696@ftp.COM> wjr@ftp.UUCP (Bill Rust) writes:
>In article <10684@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn) writes:
>>In article <961@virtech.UUCP> cpcahil@virtech.UUCP (Conor P. Cahill) writes:
>>>NULL + 1 is a valid operations, ...
>>No!
>In my experience, NULL is always defined using the preprocessor line
>"#define NULL 0" (or 0L). Since the while construct is relying on the
>fact NULL is, in fact, 0, doing NULL + 1 - 1 is ok.
>Bill Rust (wjr@ftp.com)


I have to disagree with Bill here.  The NULL being
returned was from a string manipulation function...ie
not just a NULL but a (char *) NULL....I believe it is
illegal (or at least unportable) to add (char *)NULL + 1.


-- 
===========================================================
Name:	Bob Earl		Phone:	(202) 872-6018 (wk)
UUCP:	...!uunet!wash08!rae98
BITNET:	...rae98@CAS	(At least, that is what I'm told)