Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Clang is able to be used instead of gcc? What your experience on that? What disadvantages there are yet?

Performance of compilation is very better than gcc but about performance of code generated when executing it?

Are there good tools as front-end (IDE) to run on Linux or Windows?

EDIT: I mean C compiler. C++ it's not so good yet.

share|improve this question

closed as not constructive by MichaelT, BЈовић, gnat, Kilian Foth, Walter May 28 '13 at 11:33

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

3 Answers 3

Update: Now (2013) Clang is ready for prime time and used by some companies like Google. However it is not totally usable on Windows, work on this platform is a "work in progress". LLVM/Clang is currently the default compilator on MacOSX/XCode but it's not exactly the same releases than the LLVM ones so beware of the minor differences (mostly difference of version numbers).


Well following the clang dev mailing list, recently the trunk version have been successfully building :

  • the linux kernel (a recent revision)
  • Qt (with it's special build process too, apparently)
  • Chromium (a recent revision)

So, I would say that the coming version (2.9) might be a good "ready for prime time" compiler.

However, if your project have a a planning and budget, maybe it's not a good idea to try a compiler that isn't heavily tested yet. If you're allowed to experiment and provide feedbacks to the Clang developers community, then go for it, it's win-win for everybody. If not, maybe you should use a mature-and-heavily-used compiler like gcc (in its recent versions) to have a "stable ground" to rely on while working on your project.

share|improve this answer
    
Just to complementation, it's not a professional project... yet, it's almost a 20% work-time project. –  bigown Nov 9 '10 at 19:01
    
I would have tried clang on a non-professional cross-platform project. In fact that's what I'm trying right now. –  Klaim Nov 9 '10 at 21:08
    
Thanks. My concern is about the future of project. I will start as an experiment but I wish to do more than that soon. –  bigown Nov 9 '10 at 22:18
    
If it's a long-run project, it might beneficat from CLang once it's stable, correct, optimized and full-C++0x featured (if you use c++). Because it's target is to be the faster compiler out there and apparently, it already is. And it's important. –  Klaim Nov 9 '10 at 22:54
1  
Clang is also building iOS, Xcode, and pretty much everything Apple is shipping. –  Mike Weller May 28 '13 at 9:55

Well, it's certainly ready for primetime on Mac OS X, as many Mac OS X apps are compiled using clang. But even on other platforms, C support is pretty solid, and the team has made great strides with C++ support.

Generally speaking, clang compiles code faster than gcc, but gcc generates better-optimized code. (There are edge cases where this isn't true, but in general, that's the current status.)

share|improve this answer
    
I see the same problem, Clang is too tied to MacOS/BSD yet. –  bigown Nov 9 '10 at 19:03
    
I tried CLang on Windows 7 and it worked correctly. I tried it on Ubuntu too. I think your information is not up to date, but that's logic as a lot of cross-platform fixes effort have been put in the last months. So maybe it will not be so mac-centric once the next version is out. –  Klaim Nov 9 '10 at 21:06
1  
@Klaim: I'm not saying about Clang per se, but the whole ecosystem. I tried some things on Win7 whiteout problems, but just the compiler on cli. –  bigown Nov 9 '10 at 22:15
    
I've found that Clang created a faster binary than GCC for my project. It's worth at least trying it out. –  Kendall Hopkins Nov 9 '10 at 23:01
    
Also, is the default compiler now for iOS. –  mamcx Oct 1 '12 at 18:02

You shouldn't really depend on a specific compiler unless you really need to. So you should be able to change the compiler at a Makefile or something and everything should work well.

Here I use mainly clang for my toy projects, because it is faster, and much more important: its error messages are so damned clearer. But when I need to use gdb, I compile with gcc and -ggdb. So clang isn't feature complete yet, and couldn't be my sole compiler.

(BTW: I'm on x86 gentoo, and the projects are in C and C++)

edit: to clarify, clang runs faster (in some cases, much faster). I don't care about fancy optimizations.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.