This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: stdint.h
- From: Corinna Vinschen <vinschen at redhat dot com>
- To: newlib at sources dot redhat dot com
- Date: Tue, 20 Sep 2005 19:29:31 +0200
- Subject: Re: stdint.h
- References: <20050920163904.GA3097@calimero.vinschen.de> <200509201705.j8KH5rEK016735@mx1.redhat.com>
- Reply-to: newlib at sources dot redhat dot com
On Sep 20 18:05, Jon Beniston wrote:
>
> > I'd like to point out that the glibc version of stdint.h also uses the
> > (-2147483647 - 1) variation. There must be a good reason,
> > but I fail to find a reference right now, which could help to
> > explain this to all of us.
>
> Doesn't your version of gcc output:
>
> warning: this decimal constant is unsigned only in ISO C90
>
> Try -std=gnu99 and you might get a different result.
>
> In C90 mode, GCC treats 2147483648 as an unsigned int. It then negates it,
> before casting to a long long, and -2147483648 is the same as 2147483648 in
> only 32-bits.
Well, that explains it, doesn't it? I tried with -std=gnu99 and
the constant -2147483648 is correctly translates to
.quad -2147483648
then and also doesn't throw a warning message. But that also means it's
not safe to use these constants since you can't expect -std=gnu99.
Corinna
--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat, Inc.