I have the following Code C\C++:

static int foo = 0;

static void bar(void)
{
    foo = 1;
}

Here it is clear for the compiler that the variable foo can only be
accessed from the same modul and not from ther modules. From the
explanations before I understand that the variable is removed due to
optimization. But I do not understand why GCC does not throws a warning.

>From my point of view it is responsibility of the developer to remove
the unused variable.


Reply via email to