incrementing after a cast
ccplumb at watnot.UUCP
ccplumb at watnot.UUCP
Wed Dec 17 03:39:23 AEST 1986
In article <755 at dg_rtp.UUCP> throopw at dg_rtp.UUCP (Wayne Throop) writes:
>
>Can someone explain why anybody who has thought about it for more
>than a few minutes WOULD expect that last example, or things like
>((sometype *)p)++, to work?
I think the idea is it should act like...
temp = (sometype)p
p = (p'stype *)(temp++)
...which is what you could expect on a system where the type coercion
is a null operation (the bit patterns of p and (sometype *)p are
identical), so the temporary variable that holds (sometype *)p, and
gets incremented by the ++, is p itself.
Of course, if the compiler checks syntax more carefully, or is on a
system where the bit patterns of the two types are different, this
will bomb out instantly.
-Colin Plumb (ccplumb at watnot.UUCP)
Zippy says:
But was he mature enough last night at the lesbian masquerade?
More information about the Comp.lang.c
mailing list