Re: Switching from GCC to Clang, any downsides?
Re: Switching from GCC to Clang, any downsides?
- Subject: Re: Switching from GCC to Clang, any downsides?
- From: Ingvar Nedrebo <email@hidden>
- Date: Tue, 8 Sep 2009 10:42:46 +0100
On Sep 7, 2009, at 18:47, Markus Spoettl wrote:
Reading the Snow Leopard review on Ars Technica, the author writes
that Clang is now Apple's recommended compiler. So I thought I look it
up in the documentation, but there's not terribly much on Clang at
all. In fact there's not the slightest hint that this statement is
true - judging from the docs and release notes alone.
I've since switched to Clang and everything appears to be perfectly
fine. However, since there's so little in information on this topic
there may be some caveats involved when switching from GCC. Are there?
I know - and love - the static analyzer and what it can do. I'm
specifically interested in effects that the compiler switch may have
on my executables. The only effects I know are I get some better
warnings and it's fast and produces fast executables. So, are there
other effects (specifically bad ones, if there are any)?
The one I've found is that clang doesn't warn about missing returns
from non-void functions. To wit:
---------------------------------
mine.m:
#import <Foundation/Foundation.h>
@interface Mine : NSObject
@end
@implementation Mine
-(id)init
{
self = [super init];
//return self;
}
@end
----------------------------------
$ clang -Wall -c mine.m
$ gcc -Wall -c mine.m
mine.m: In function ‘-[Mine init]’:
mine.m:13: warning: control reaches end of non-void function
Through some unfortunate editing on my part I had done just this, i.e.
lost the 'return self' statement from an init method. Took me a while
to track down because I'm so used to being warned about this
problem.
i.
_______________________________________________
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