discuss-gnustep
[Top][All Lists]
Advanced

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

Re: clang vs gcc 4.7


From: Richard Frith-Macdonald
Subject: Re: clang vs gcc 4.7
Date: Sun, 3 Mar 2013 12:17:17 +0000

On 3 Mar 2013, at 11:51, Tom Davie wrote:

> 
> On 3 Mar 2013, at 11:45, Luis Garcia Alanis <luis@garcia.tv> wrote:
> 
>> Hi,
>> 
>> I was reading that clang had support for ObjectiveC 2.0 and gcc didn't. 
>> However I also read that as of gcc 4.6 it also supports ObjectiveC 2.0.
>> 
>> Is there a reason clang should be used? 
>> 
>> Etoile seems to require clang. This makes me thing clang still doing 
>> something that gcc cant.
> 
> Clang runs faster in -O0 mode.
> Clang produces faster code in -O3/-Os mode (especially for objc).
> Clang produces better error messages.
> Clang will be updated in the future with all of apple's changes to 
> objective-c.
> Clang is more friendlily licensed (not that I want to start a flamewar, and I 
> realise this argument may not be strong on this particular list).
> Clang's codebase is easier to work on.
> Clang supports being used as a library, and hence can have other tools (e.g. 
> google's refactored, or the static and (in early development) dynamic 
> analysers) built upon it.
> Clang's C++ support is better than gcc's.
> 
> Is there any reason gcc should be used over clang?

I think this is rather debatable and you could probably find people to disagree 
with most of your points.
eg. I've heard that gcc produces faster code than clang ... so opinions 
certainly vary there, and from my own experience, while clang produces more 
readable error messages, it also produces more spurious error/warning messages 
... so you can lose track of real errors amid the bogus ones (eg warnings about 
assigning a value of a subclass to a variable typed as its superclass).

My take on the relative merits is:

The advantages of gcc are that it's the de-facto standard (you generally don't 
have to install it, let alone build it yourself), is much more portable/ported 
(reliable on many more platforms), and has most of the good things that Apple 
has added to objc, and less of the the bloat such as 'blocks'.

but clang has two really nice things going for it:
1. the static analyser can spot quite a few coding errors, and that's great
2. clang has ARC support, which is really cool

Since I generally want high portability, I stick with code that builds in gcc, 
but I do use clang for the static analyser.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]