Re: type-punning to incomplete type might break strict-aliasing rules
Re: type-punning to incomplete type might break strict-aliasing rules
- Subject: Re: type-punning to incomplete type might break strict-aliasing rules
- From: Kenny Leung <email@hidden>
- Date: Tue, 22 Jul 2008 15:34:43 -0700
Too bad. I hope this will be fixed soon.
I didn't know compilers had a sense of humor, but evidently they like
puns :-)
-Kenny
On Jul 22, 2008, at 11:22 AM, Sean McBride wrote:
On 7/22/08 7:07 AM, Kenny Leung said:
Just trying to keep up with the latest here. I heard many good things
about llvm-gcc at WWDC. Since switching to llvm-gcc, I'm getting a
lot
of these warnings.
warning: type-punning to incomplete type might break strict-
aliasing rules
I must admit I have no idea what it really means, even after reading
an explanation on the net about it. It pops up in my code when
dereferencing typecast pointers. I've eliminated the few places in
our
code where it occurs, but I don't know how to eliminate this one.
There's a warning for every use of CFSTR() to generate a constant
CFString.
return CFSTR("com.quickceph.documentlegacy");
What should one do in this situation?
I've seen that too. IMHO it's a bug. I've filed <rdar://5509977>.
You
can repro like this:
-----------
#include <CoreFoundation/CoreFoundation.h>
int main (void)
{
CFStringRef str = CFSTR("Hello");
(void)str;
return 0;
}
-----------
gcc-4.2 -Wall -fstrict-aliasing -framework CoreFoundation foo.m
Alas, practically speaking, I've found this makes -fstrict-aliasing
useless for real-world Mac apps. Pity.
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden