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

Somewhat off-topic, but to defend gcc against clang, here is a modern version of gcc with the correct warning option:

    $ gcc-4.8 -std=gnu99 -Wall -o test test.c
    test.c: In function 'main':
    test.c:6:5: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
         if (foo & 0x80 == 0x80) {
         ^
gcc 4.9 will have colored diagnostics, too.

Cool project, though.




The rivalry between gcc and clang has been wonderful for everybody who use either of them.


Some of these warnings start delving a bit too close to "Warning: Competent C programmer detected", ... too eager to flag "less common" usage like the dreaded 'original definition of the insertion operator' rather than specifically targeting things that are genuinely suspicious.


This would be a great way, on a compiler or project that doesn't have this warning enabled, to conceal a deliberate bug and have it appear to be accidental.


Hey, check out the Underhanded C Contest.

http://underhanded.xcott.com




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

Search: