On Feb 25, 2005, at 10:31 AM, David Cargill wrote:

Hi James/Alberto,
I checked in a fix for XSValueTest. Can you let me know if it gets rid of
the errors? Thanks.

Hi Dave,

This fixed the errors, but some warnings remain:

XSValueTest/XSValueTest.cpp:1363: warning: this decimal constant is unsigned only in ISO C90
XSValueTest/XSValueTest.cpp:1516: warning: this decimal constant is unsigned only in ISO C90
XSValueTest/XSValueTest.cpp:1662: warning: this decimal constant is unsigned only in ISO C90
XSValueTest/XSValueTest.cpp:1808: warning: this decimal constant is unsigned only in ISO C90
XSValueTest/XSValueTest.cpp:1965: warning: this decimal constant is unsigned only in ISO C90
XSValueTest/XSValueTest.cpp:2427: warning: this decimal constant is unsigned only in ISO C90
XSValueTest/XSValueTest.cpp:2578: warning: this decimal constant is unsigned only in ISO C90
XSValueTest/XSValueTest.cpp:2736: warning: this decimal constant is unsigned only in ISO C90
XSValueTest/XSValueTest.cpp:3190: warning: this decimal constant is unsigned only in ISO C90



These are due to the fact that C90 doesn't treat constants quite the same way. I think the simplest way to avoid these warnings, if it's desired, would be to simply enter the numbers in hex, which is easier to understand for these numbers anyway... ;) But it may not be worth it.


Thanks for cleaning up those other errors.

-jdb

See (http://gcc.gnu.org/ml/gcc-bugs/2003-04/msg00082.html):

> 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?


It's because c90 says that the constant is 2147483648 (which is not
representable as a signed 32-bit value).  To that constant you've then
applied the negation operation.

c90 doesn't have negative constants, only positive ones that have been
negated...


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to