Live data from Hacker News

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

fseek.me

1–10 of 97 posts

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

#2
Part of being a C developer (or C++ template) developer is in fact understanding what the compiler spits out. So, this did't convine me enough because "two or more data types" made me skip right a head to the definition of Point. :-)

My point is Clang is good but friendly error messages is not the only reason I would change to Clang.

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

#5
post #3

An even better reason to use clang: it supports Apple's new syntax for blocks. I'm trying to think of a new project to write in C now just to take advantage of the simple anonymous functions and closures that are possible.

Proprietary extensions are one reason that gcc is so hard to unseat. You're always better off writing standard code if you want it to work in ten years.

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

#6
I'm not sure this screenshot is convincing. Do you see the last error message?

In the second error message clang found that `horisontal` doesn't exist and suggested `horizontal`. That's fair enough. The last error message actually assumes the code said `horizontal`, which is just horribly wrong. I think that the compiler should never ever report an error on code that is not really there. What would happen if the programmer got a list of error and started fixing from the end? What if the guessed name was wrong? The programmer would spend time chasing some bug which doesn't exist outside of compiler's "that's what you probably meant" version of code.

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

#7
post #6

I'm not sure this screenshot is convincing. Do you see the last error message? In the second error message clang found that `horisontal` doesn't exist and suggested `horizontal`. That's fair enough. The last error message actually assumes the code said `horizontal`, which is just horribly wrong. I think that the compiler should never ever report an error on code that is not really there. What would happen if the prog…

the struct point holds a def for the correct spelling so I would guess that they are using known good variables and suggests the one that is closest to it.

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

#8
post #6

I'm not sure this screenshot is convincing. Do you see the last error message? In the second error message clang found that `horisontal` doesn't exist and suggested `horizontal`. That's fair enough. The last error message actually assumes the code said `horizontal`, which is just horribly wrong. I think that the compiler should never ever report an error on code that is not really there. What would happen if the prog…

"What would happen if the programmer got a list of error and started fixing from the end?"

I always fix the first 1 or 2 reported errors and try to recompile. I assume everyone did. A traditional "report on errors which are actually there each time they happen" compiler will give you tons of completely spurious errors which happily disappear once you fix the first few.

In the instance you point out, it could just uselessly say "no member named horisontal" but it knows it already gave you that error. So instead of repeating itself or shutting up, it reasons in the alternative--even if the name was corrected, the type is wrong. I would actually find that far more useful for fixing all the compiler errors at once.

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

#10
you're saying I should port all my code just because the ui is more user-friendly? what about performance, options, special warnings, builtins, and everything else?

I've been using gcc for a while now, and every time I use it I found a new feature. It's rock solid and had never let me down.

Post reply on HN