Groovy hepcat Richard Heathfield was jivin' on Sat, 14 Jan 2006
09:17:41 +0000 (UTC) in comp.lang.c.
Re: Why (type*)pointer isn't equal to *(type**)pointer?'s a cool
scene! Dig it!
>lovecreatesbeauty said:
>In this case, the pointer &ch is converted to int *, but there is no
>guarantee that a char is aligned in a manner proper to int. So the pointer
>is (at least potentially) invalid, and the code is therefore not portable.
>
>> 10 p2 = *(int **)(&ch);
>
>The same applies, so again this is not portable C.
Yes, and this is even worse still. The OP is actually dereferencing
the pointer here. And you know what happens when one dereferences a
pointer pointing at an object of an incompatible type. BANG! Undefined
behaviour!
--
Dig the even newer still, yet more improved, sig!
http://alphalink.com.au/~phaywood/
"Ain't I'm a dog?" - Ronny Self, Ain't I'm a Dog, written by G. Sherry & W. Walker.
I know it's not "technically correct" English; but since when was rock & roll "technically correct"?