How to convince any C developer to dump gcc and use clang

Most C developers I know hate those wrong or incomplete warnings that GCC sometimes give to us. Plus, it seems to always happen when you are in a rush trying to debug something or get the code out.

However today, I saw a screen shot that convinced me to give clang a shot (at least on my test environments). For those who doesn’t know, clang is C/C++ front-end for the LLVM compiler.

Take a look and let me know if you can find one C developer who is not convinced to use clang :)

Clang

  1. aCguy says:

    meh

  2. SteveC says:

    Meh. Anybody calling themselves a C developer and actually being worthy of the name isn’t going to find this all that convincing. No C developer worthy of the name has a hard time getting their C code to merely compile. If you have a hard time getting your code to compile, despite any cryptic error messages, you’re a novice, period.

  3. Nader says:

    I’m not a C developer myself, just reading hacker news daily. Interesting to see that GCC doesn’t have proper warnings although the compiler is already around for some time. Does clang have any drawbacks?

  4. Jose says:

    Excuse me?

    I use gcc daily and had never experience “wrong or incomplete warnings” from gcc. Never.

    I use -Wall so if this was true I should know.

  5. Moschops says:

    Where would a programming blog be without comments from arrogant dickheads? Thanks for your excellent reminder of the “no true Scotsman” approach Steve. I’m afraid you’re dead wrong, though. No C developer worthy of the name actually codes in C – once one becomes comptent, one switches to butterfly-driven bit flipping on the medium itself. Only a total incompetent like you wouldn’t know that.

  6. Tronic says:

    Clang doesn’t fully support C++ yet, but other than that not really.

  7. MrG says:

    Jose, you have never seen how one error will spawn more erroneous errors after it? Forget one semi-colon and you’ll get all sorts of lovely errors and warning. Of course, it’s not hard to track down, but it would be more interesting if you could see any other actual errors at the same time.

    Had the C++ support been there, I would definitely recommend it to two friends learning it, since it would make it a lot easier to parse problems.

    If I have a C only project, I’ll give it a go, since I liked the output of it.

    Moschops, yeah it is sad to see how people start bashing something just because they are so l33t..
    And especially since everyone knows that real C-programmers just enters a zen-like state and code flows unhindered into the machine, bypassing the need for compilers, editors and such silly stuff…

  8. Brian King says:

    I’d love to see how they do with templates. Nothing like copying a stack trace and spending 3 minutes formatting it to figure out what the hell it’s trying to say.

    While not a reason to switch on it’s own, what is exciting as a C developer is the amount of work going into these tools. Maybe it’s just my news sources, but LLVM has brought a lot of energy to the less-sexy toolsets.

  9. Jason says:

    @Steve – so does that mean that there’s no such thing as a “novice C developer”?

  10. John Baptist says:

    I don’t understand why all the comments are poo-pooing the obviously superior output from clang. This is the future, guys. gcc is stagant and the codebaes is a mess. In a few years, clang will be the standard FOSS compiler. It’s just a question of when you’re going to get on board.

  11. Neural.Disruption says:

    Well GCC error messages are compact and concrete enough if you know what you’re doing, I like to read an error or warning without having to scroll up and down.

  12. Steve Webb says:

    I’m a C programmer and that article didn’t really convince me to use clang. I hear that LLVM is more heavily-optimized than normal gcc-compiled C, but just based on error message coloring and a different error syntax, since I’m pretty used to the gcc error syntax, I don’t really see anything ground-breaking that would make me want to switch.

    Isn’t there a color-coded ‘make’ or ‘gcc’ that does the color-coding of the error messages similar to this out there somewhere already?

  13. MrG says:

    Brian King, have you tried STLFit: http://www.bdsoft.com/tools/stlfilt.html
    It does a wonderful job of clearing up those template error messages.

  14. Rusky says:

    Clang remembers typedefs and templates so its template error messages end up the same size as all the other ones, not kilobytes long.

    You can also enable and disable each part of the error messages, so they can be just as compact as GCC while not being completely off the mark.

    Error messages are not the only reason to switch, but they’re a big one if you’re dealing with templates, someone else’s code or you’re learning.

  15. Paul says:

    I use gcc daily and often run into wrong and incomplete warnings. GCC 4.4 with -O3 has a habit of generating warnings where it can’t tell you where in the code they actually come from. GCC’s warning control is crap. And it’s not even possible to disable some warnings (e.g. the infamous memset arguments reversed warning). And every new version of GCC that comes out has some new ridiculous warnings that don’t do anybody any good. I use pretty much all the major commercial compilers (GCC, VC++, CodeWarrior, ARM, IBM, EDG) and GCC is easily the worst of these with respect to warnings (EDG-based compilers are the best). GCC doesn’t even have the concept of warning numbers nor the ability to control warnings within files. Awful.

  16. Dmitrijs Ledkovs says:

    From a package maintainer point of view. I only ever see plain text buildlogs from a buildfarm. And I would like a reliable compiler that can compile majority of software out there.

    So for something like debian to switch from gcc as default compiler you would need to prove that clang doesn’t break ABI/API with respect to previously compiled code and that it is better somehow =) note gcc does c, c++, java, ada, fortran, obj-c, obj-c++ out of the box =)

  1. [...] full post on Hacker News If you enjoyed this article, please consider sharing it! Tagged with: Clang • [...]

  2. [...] fseek.me » Blog Archive » How to convince any C developer to dump … [...]

  3. [...] Would love have these in gcc Published March 7, 2010 General Leave a Comment via fseek.me [...]

  4. [...] fseek.me » Blog Archive » How to convince any C developer to dump … [...]

Leave a Reply