News for hackers. Stuff that matters.
Re:What is C in practice? by userbinator on Monday June 29, 2015 @01:41PM (#9799612)
MSVC will very confidently warn on cases like this by default:

    int foo() {
        int bar;
        return bar + 5; /* C4700: local variable 'bar' used without having been initialized */
    }
https://msdn.microsoft.com/en-us/library/axhfhh6x.aspx

In the same situation, GCC says "may be used uninitialized in this function" if you enable the warning (-Wmaybe-uninitialized), despite this being a trivial and certain case.

Re:What is C in practice? by ydcvjk on Monday June 29, 2015 @01:58PM (#9799733)
gcc 4.9.2 gives: warning: 'bar' is used uninitialized in this function

Maybe you are using a old version.

If you enable -Wall which you always should then this flag is automatically enabled.

https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#inde...

Re:What is C in practice? by anon1385 on Monday June 29, 2015 @04:58PM (#9801015)
-Wuninitialized has been broken in GCC for over a decade: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=18501
Re:What is C in practice? by anon4 on Tuesday June 30, 2015 @06:39AM (#9804178)
As if we needed more proof that GCC is a fucking joke...
Re:What is C in practice? by ydcvjk on Tuesday June 30, 2015 @09:25AM (#9804985)
Hey Linus, how are you doing!
Re:What is C in practice? by bluecalm on Monday June 29, 2015 @01:58PM (#9799735)
While I like MSVC team approach to this I don't think it's necessarily worse to just warn as long as that warning consistently work. I mean, just add some warning options to your compiling script and you are good to go. I am getting this error from GCC very consistently and as good as compilation error in practice.