Article View: comp.std.c
Article #987Re: sizeof ((rehash *) 0)->again
From: Doug Gwyn
Date: Tue, 21 Nov 1989 22:50
Date: Tue, 21 Nov 1989 22:50
20 lines
1475 bytes
1475 bytes
In article <11146@riks.csl.sony.co.jp> diamond@ws.sony.junet (Norman Diamond) writes: >In the part of my posting which you deleted, I pointed out where the >standard deliberately does not define a cast null pointer to be a >null pointer constant, unless the cast is to void *. Which has nothing to do with it. "Null pointer constant" has technical uses within the standard, but both null pointer constants AND other kinds of null pointers don't point to anything. >Therefore the compiler cannot take advantage at compile time of knowing >that this is a null pointer; ... Your argument supports the position that conforming implementations are not REQUIRED to diagnose ((foo*)0)->bar, but compilers that are able to recognize that situation, so far as I can determine, MAY diagnose it at compile time as a semantic violation, in which case it would be folly to use such a construct in code intended to be portable. As I've said before, I think this deserves an official "interpretation" ruling.
Technical Details
Message-ID:
<11662@smoke.BRL.MIL>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!purdue!haven!adm!smoke!gwynReferences:
<11138@riks.csl.sony.co.jp> <11628@smoke.BRL.MIL> <11146@riks.csl.sony.co.jp>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!purdue!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.std.c Subject: Re: sizeof ((rehash *) 0)->again Message-ID: <11662@smoke.BRL.MIL> Date: 21 Nov 89 22:50:28 GMT References: <11138@riks.csl.sony.co.jp> <11628@smoke.BRL.MIL> <11146@riks.csl.sony.co.jp> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 20