Uninitialized integers and warnings

Kirill Tkhai tkhai@yandex.ru
Wed Sep 4 13:40:00 GMT 2013


the following example compiles without warnings:

$ cat a.c
int func (int p)
        int x;
        if (p != 0)
                x = 1;
        return x;

$ gcc -c a.c -Wall
(no messages)

Is there no error? Why compiler doesn't print a error
about uninitialized variable?

I saw many pieces like this in GNU software. Does
it mean that it is a de-facto standard and gcc won't warn
about code like this in the future?


More information about the Gcc mailing list