Re: xcode 1.2, -fast and ppc_intrinsics.h
Re: xcode 1.2, -fast and ppc_intrinsics.h
- Subject: Re: xcode 1.2, -fast and ppc_intrinsics.h
- From: Glen Low <email@hidden>
- Date: Thu, 29 Apr 2004 08:26:54 +0800
All:
On 29/04/2004, at 1:09 AM, Mark Eissler wrote:
I think my problem (re: type-punning) is triggered by the fact that
-fast turns on strict aliasing rules. I'm puzzled though because it's
flagging my classes as being problematic. And I can't see why that is.
Sure I could just turn off -fast, or at least strict aliasing, and
probably continue on my way....but stuff like this just gets under my
skin because something is obviously not right! Better to fix it now
then have it haunt you later on.
-mark
On Apr 28, 2004, at 12:32 PM, email@hidden wrote:
Mark Eissler wrote:
I would like to use -fast too, but in my attempt to use this a.m. I
get a huge number of warnings of the following sort:
Not seeing your source it's difficult for me to comment.
The C89/C99 and C++98 aliasing rules state that you shall not access an
object of type X through an lvalue (e.g. pointer, reference) of type Y,
where X and Y are unrelated. Perhaps this is interacting badly with
ObjC. (In C++, X and Y can be related through inheritance, but in C
there's no such thing so I don't know how it falls out in ObjC).
Here's a quick C sample:
long* i;
*i = 12; // *i now points to a long
printf ("we got %f", *(float*) i); // this is bad, accessing the long
as if it were a float
In practice the aliasing rules really only optimize tight, inlined
loops, so you should be quite safe leaving it off ObjC code. You might
try -fno-strict-aliasing in addition to -fast to do this (caveat --
haven't tried this myself).
The warning itself is likely only a warning rather than a hard error --
you could try googling for it to see what the gcc folk say.
Cheers, Glen Low
---
pixelglow software | simply brilliant stuff
www.pixelglow.com
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.