warning message "decimal constant is unsigned only in ISO C90"

Fred Fish fnf@public.ninemoons.com
Wed Apr 2 16:14:00 GMT 2003


I'm getting this warning when trying to initialize a signed int with
the most natural form of a constant for the maximum negative value:

  $ cat x.c
  signed int maxneg1 = -2147483648;       /* This gives a warning */
  signed int maxneg2 = -2147483647 - 1;   /* This is OK */
  signed int maxneg3 = 0x80000000;        /* This is also OK */

  $ /usr/local/sourceware/bin/gcc -c x.c
  x.c:1: warning: this decimal constant is unsigned only in ISO C90

  $ /usr/local/sourceware/bin/gcc --v
  Reading specs from /links1/usr/local/sourceware/bin/../lib/gcc-lib/i686-pc-linux-gnu/3.4/specs
  Configured with: /src/sourceware/gcc/gcc/configure -v --prefix=/usr/local/sourceware --cache-file=config.cache --enable-languages=c,c++
  Thread model: posix
  gcc version 3.4 20030401 (experimental)

Is this some sort of bug or just a quirk of how integer constants are
converted from external to internal format on a 32 bit two's
complement machine?

-Fred



More information about the Gcc-bugs mailing list