🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3079

Re: Casting Function Pointers

#3079
From: Norman Diamond
Date: Mon, 27 May 1991 06:22
26 lines
2254 bytes
In article <16271@smoke.brl.mil> gwyn@smoke.brl.mil (Doug Gwyn) writes:
>In article <1991May25.221756.16182@zoo.toronto.edu> henry@zoo.toronto.edu (Henry Spencer) writes:
>>In article <16259@smoke.brl.mil> gwyn@smoke.brl.mil (Doug Gwyn) writes:
>>>I'm not aware of any changes between the final draft of K&R2 (first printing)
>>>and the official C standard that would make K&R2 less correct...
>>I know of at least one -- it's no longer promised that casting a pointer to
>>integer and back preserves its value if the integer is big enough -- and
>>there are probably a few more.
>
>X3.159-1989 Section 3.3.4 Semantics require that there be some such
>implementation-defined type.  Well, actually, it doesn't require that
>the "before" and "after" pointers compare equal, but that is clearly
>the intent, for implementations where this is even possible.

I nearly pounced on the first sentence with a "wrong" (in the style that
Mr. Gwyn was famous for, though recently he seems more sociable).  The
second sentence indeed points out that the first one is wrong.

As for intents, Section 3.3.4, and even the footnote, do not say.  There
is no requirement and not even a suggestion.  Intuitively, and for quality
of implementation, one might like to see it.  However, neither portable
code nor strictly conforming code could make any use of it.
--
Norman Diamond       diamond@tkov50.enet.dec.com
If this were the company's opinion, I wouldn't be allowed to post it.
Permission is granted to feel this signature, but not to look at it.
Technical Details
Message-ID: <1991May27.062242.27571@tkou02.enet.dec.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!decwrl!pa.dec.com!jrdzzz.jrd.dec.com!tkou02.enet.dec.com!jit533!diamond
References: <1991May24.005025.7714@tkou02.enet.dec.com> <16259@smoke.brl.mil> <1991May25.221756.16182@zoo.toronto.edu> <16271@smoke.brl.mil>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!decwrl!pa.dec.com!jrdzzz.jrd.dec.com!tkou02.enet.dec.com!jit533!diamond
From: diamond@jit533.swstokyo.dec.com (Norman Diamond)
Newsgroups: comp.std.c
Subject: Re: Casting Function Pointers
Message-ID: <1991May27.062242.27571@tkou02.enet.dec.com>
Date: 27 May 91 06:22:42 GMT
References: <1991May24.005025.7714@tkou02.enet.dec.com> <16259@smoke.brl.mil> <1991May25.221756.16182@zoo.toronto.edu> <16271@smoke.brl.mil>
Sender: usenet@tkou02.enet.dec.com (USENET News System)
Reply-To: diamond@jit533.enet@tkou02.enet.dec.com (Norman Diamond)
Organization: Digital Equipment Corporation Japan , Tokyo
Lines: 26