Hacker News new | past | comments | ask | show | jobs | submit login

As somebody who is learning C++ and decided to go with clang, the error reporting is absolutely phenomenal. It tells me not only what line errors are on but also makes suggestions as to how to fix it. I don't ever recall GCC having very helpful error messages.



Agree. Clang vs. GCC is like PostgreSQL vs. MySQL (regarding usefulness of error messages).


However, in C language features GCC becomes PostgreSQL and Clang becomes MySQL (Things like nested functions to name one).


GCC has nested functions, which most GCC users hate. Clang has blocks, which are at least widely used on OS X at least and proposed for standardization. I'm not sure this is a point in GCC's favor.


As an Objective-C (iOS) developer, I really love blocks. I thought the syntax was kind of weird when starting to learn it, but it's grown on me. I really hope ObjC blocks will become part of the C standard someday. If I remember people have proposed C++ lambdas to become part of the C standard as well. It will be interesting to see which one (if any) will win in a standardising process.

More info on ObjC blocks vs C++ lambdas in this blog posting: http://www.mikeash.com/pyblog/friday-qa-2011-06-03-objective...


Is that C language features or compiler-specific extensions? Arguably, sticking to the standard is actually the better alternative here in terms of portability.


You're right - it's a compiler extension to a language (apparently) called "GNU C"[1]: http://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html

Seems like a very nice feature though.

[1]: First time I've heard this term. I'm not sure how I feel about it.


You can usually use "-std=c99" to ban features of concern.


Clang has blocks, which, while different, are at least an arguably superior replacement for gcc's nested functions.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: