Avoiding "assignment from incompatible pointer type" warning
Florian Weimer
fw@deneb.enyo.de
Mon Oct 21 07:17:00 GMT 2002
"Moore, Mathew L" <MooreML@BATTELLE.ORG> writes:
> To help expand my (very) limited knowledge, does this mean that
>
> float f;
> int *p = (int*)&f;
>
> may not work even if sizeof(float) == sizeof(int)?
I think so.
Alignment is defined informally as:
3.2
[#1] alignment
requirement that objects of a particular type be located on
storage boundaries with addresses that are particular
multiples of a byte address
This definition is independent of the size of the type. Furthermore,
there's no way to determine the required alignment of a type.
More information about the Gcc-help
mailing list