Casting Function Pointers

Norman Diamond diamond at jit533.swstokyo.dec.com
Mon May 27 16:22:42 AEST 1991


In article <16271 at smoke.brl.mil> gwyn at smoke.brl.mil (Doug Gwyn) writes:
>In article <1991May25.221756.16182 at zoo.toronto.edu> henry at zoo.toronto.edu (Henry Spencer) writes:
>>In article <16259 at smoke.brl.mil> gwyn at 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 at 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.



More information about the Comp.std.c mailing list