This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Warning Behavior
- From: Paolo Bonzini <paolo dot bonzini at lu dot unisi dot ch>
- To: GCC Development <gcc at gcc dot gnu dot org>, Ivan dot Novick at makoglobal dot com
- Date: Tue, 23 Aug 2005 08:54:55 +0200
- Subject: Re: Warning Behavior
- References: <200508230646.j7N6k6l28468@uk01dw003.uk.makoglobal.com>
Ivan Novick wrote:
Hello,
How come the following code would not be considered a Warning?
Surely there is no possible way this would be intentional?
if (x<4);
x++;
When you consider macro expansion, it could:
#if SIZEOF_LONG == 4
#define WARN_FOR_BIG_VALUES \
printf ("hey, x is too big, keeping low bits only!")
#else
#define WARN_FOR_BIG_VALUES /* nothing */
#endif
...
long f (long long x)
{
if (x > LONG_MAX)
WARN_FOR_BIG_VALUES;
return x & LONG_MAX;
}
(I'm not saying this is good code).
Paolo