gcc warn unreached else {}

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello!

There is an example below, (my code is not like this example below). I'm reporting a possible issue, and asking if there is a way to detect it in code bases. If it's a real issue I can file a bug report on Bugzilla.

Can gcc warn where code will not get to the 'return 3;' below?

Cheers, Jonny


int main(void)
{
    const int i = 1;
    if(1 == i)
    {
        return 1;
    }
    else if(1 != i)
    {
        return 2;
    }
    else
    {
        return 3;
    }
}




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux