Re: Question on strict aliasing in C.

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

 



On 05/07/11 23:56, kevin diggs wrote:
> Hi,
> 
> On Mon, Jul 4, 2011 at 12:07 PM, Andrew Haley <aph@xxxxxxxxxx> wrote:
>>
>> It's not.  Tey're wrong, you're right.
>>
>> Hope this helps.  :-)
>>
>> Andrew.
>>
> 
> What about this:
> 
> #include <math.h>
> 
> #define MASK ((unsigned short) 0x8000)
> 
> double copysign (double x, double y)
> {
> unsigned short * const py = (unsigned short*)(char*)&y + 3;
> 
> 	return fabs(x)*(*py&MASK?-1.0:1.0);
> }

What are you asking?  It's still not legal, if that was the question.

Using just a char* would be OK, though.

Andrew.




[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