This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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: stdint.h


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.


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