This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

if() and trailing ;


Hi,

After a couple hours debugging code, I figured our an if() somewhere had a trailing ; like this:

                if (memcmp(p, COMMUNITY, strlen(COMMUNITY)) != 0);
                        continue; /* failed */

The code above will always reach "continue" even when memcmp() == 0.

I was surprised to see gcc doesn't report anything, I would expect a "statement has no effect" warning.

Using gcc version 3.3.5 (Debian 1:3.3.5-13)

Thanks!

Simon




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]