Re: Question on strict aliasing in C.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andrew Haley wrote:
> On 04/07/11 19:53, Georg-Johann Lay wrote:
>> Paul Smith wrote:
>>> On Mon, 2011-07-04 at 19:17 +0200, Georg-Johann Lay wrote:
>>>>>> double copysign (double x, double y)
>>>>>> {
>>>>>>     unsigned short * const px = (unsigned short*)(char*)&x + 3;
>>>>>>     unsigned short * const py = (unsigned short*)(char*)&y + 3;
>>> I don't get why you have the (char*) cast here?
>> It's not a source of mine.  I don't know the reason why it's there.
> 
> I suspect it shuts up a compiler warning.  :-)
> 
> Andrew.

No, gcc does not warn with -Wstrict-aliasing; not 4.5.2 and not 4.7
trunk; not with and not without (char*).

Johann



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux