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]

Re: Warning Behavior


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


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