Failure of "long x(cp) char * cp; { return *((long *) cp); }" is a bug?

Andrew Koenig ark at alice.UucP
Mon Jun 30 05:07:18 AEST 1986


> Isn't this really a compiler bug?  Doesn't the cast in the
> 		return *((long *) cp);
> give the compiler all the evidence it needs that it should, *on its own*,
> produce code that's the equivalent of the function call?

When you cast a pointer type to another pointer type,
you have stepped outside the bounds of the language.
The implementation is entitled to do as it pleases.



More information about the Comp.lang.c mailing list