This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Avoiding "assignment from incompatible pointer type" warning


"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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]