Live data from Hacker News

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

fseek.me

91–97 of 97 posts

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

#91
post #61

Now, now. LLVM and clang are very interesting projects but changing compilers just because of one feature isn't smart. GCC is good enough in that area and the code it generates is amazing, it often beats every other C compiler out there. And that helps keeping readable code optimized. http://lambda-the-ultimate.org/node/3674

    >> often beats every other C compiler out there
Microsoft and Intel are well-known to generate better code than GCC. So I don't know what you are referring to with "every other C compiler out there."

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

#92
post #48

Earlier quoted context omitted.

just because the ui is more user-friendly? Those better warnings aren't just due to a simple UI patch ... clang is doing better and deeper static analysis than gcc in order to even be able to produce those more intelligent warnings.

gcc with the dehydra plugin is doing better and deeper static analysis than clang.

Doesn't dehydra do static analysis for C++ code? In which case, of course it would do better then clang; clang doesn't even claim to have complete c++ support yet.

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

#93
post #54
post #53

Earlier quoted context omitted.

There is nothing deep about these warnings. It would likely be really, really simple to add them to gcc.

And yet, gcc doesn't have them.

If you think these warnings are evidence that "clang is doing better and deeper static analysis than gcc", then you have no idea how compilers work.

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

#94
post #13

Since when is it hard to find and correct syntax errors that are preventing your C code from compiling?

Why not make it easier if you can? Vagueness is hardly a virtue for a programming tool. Also, I don't think the ladies are impressed by your cryptic error fixing skills ;) What this feature needs now is code correction on the fly. Any error reporter smart enough to ask "did you mean 'x'?" should allow me to answer "yes", and write the changes to the file. That would sell clang to a lot of people.

What this feature needs now is code correction on the fly

integration with an IDE or vim/emacs + incremental compilation ==> smart error messages and corrections 'on the fly' while you're typing! sort of like how Eclipse gives you sqiggly line warnings almost instantaneously after you finish coding a line

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

#95
post #80

Earlier quoted context omitted.

roody, rufus, reek, flay, flog, probably more. Sadly, in the current state of the ruby community it's even hard to find a library that will run with ruby's own warnings enabled.

Isn't clean code valued in the Ruby community? As a contrast, I had the impression that the Python guys care more about this in their code. They also avoid eval and other runtime code generation. (Though I do not if that's related.) It seems these two languages are further apart than in their culture than anything else.

clean code, yes, but some of the warnings are actually generated in situations where the code won't be cleaner (e.g. lazy initializing an instance variable not declared in the initialization method) and since quite a lot of the most common libraries have _a lot_ of warnings, it becomes unlikely that you will have them enabled in your app, and so the thing self propagates

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

#96
post #80

Earlier quoted context omitted.

Isn't clean code valued in the Ruby community? As a contrast, I had the impression that the Python guys care more about this in their code. They also avoid eval and other runtime code generation. (Though I do not if that's related.) It seems these two languages are further apart than in their culture than anything else.

clean code, yes, but some of the warnings are actually generated in situations where the code won't be cleaner (e.g. lazy initializing an instance variable not declared in the initialization method) and since quite a lot of the most common libraries have _a lot_ of warnings, it becomes unlikely that you will have them enabled in your app, and so the thing self propagates

OK. So people should suppress the warning in those cases, so as not to desensitize?

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

#97
post #96

Earlier quoted context omitted.

clean code, yes, but some of the warnings are actually generated in situations where the code won't be cleaner (e.g. lazy initializing an instance variable not declared in the initialization method) and since quite a lot of the most common libraries have _a lot_ of warnings, it becomes unlikely that you will have them enabled in your app, and so the thing self propagates

OK. So people should suppress the warning in those cases, so as not to desensitize?

well, I do, but I understand why people don't. The likely better solution would be to have structured warnings you can enable/disable by, selector such as warning class, declaring namespace, using namespace or whatever, but that seems quite unlikely :)
Post reply on HN