This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c/10170: Is this a bug of GCC? or it's a C syntax
- From: bangerth at dealii dot org
- To: gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, xkinh at yahoo dot com
- Date: 20 Mar 2003 18:44:54 -0000
- Subject: Re: c/10170: Is this a bug of GCC? or it's a C syntax
- Reply-to: bangerth at dealii dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, xkinh at yahoo dot com, gcc-gnats at gcc dot gnu dot org
Synopsis: Is this a bug of GCC? or it's a C syntax
State-Changed-From-To: open->closed
State-Changed-By: bangerth
State-Changed-When: Thu Mar 20 18:44:53 2003
State-Changed-Why:
Your code is perfectly legal: you take the address of a
function and in the if-statement, it is implicitly compared
against zero. Since the function's address is non-zero,
the printf-branch is executed.
Other compilers will certainly not give you errors on this
code, since it is legal. They may give you warnings, as
icc does here, for example:
g/x> icc x.c
x.c(4): warning #279: controlling expression is constant
if (alwayzero)
^
W.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10170