[haiku-development] Re: Disabling Strict Aliasing for GCC4 Builds

  • From: "Alex Roman" <alex.roman@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Thu, 17 Apr 2008 15:31:15 -0700

On 17/04/2008, Michael Lotz <mmlr@xxxxxxxx> wrote:
> Hi Alex
>
> You'll need -Wall to see the warning. I only tried with what I have
>  here:

Yep, that did it... :)

On a side note, these might also show up in Coverity if that goes
through... A more permanent fix than disabling the warnings and strict
aliasing might be better in the long run.

Could some of these aliasing conflicts be avoided by using unions?

int xxx;

typedef union {
  int x;
  float y;
} test;

...

test * t = (test *)x;

x = t->x;
float y = t->y;

That piece of code does not produce any more warnings, and I *think*
it does the same thing...

-- 
Alex Roman <alex.roman@xxxxxxxxx>

Other related posts: