This is the mail archive of the cygwin mailing list for the Cygwin 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: long_int vs int byte sizes


On Apr  7 09:39, Eric Blake wrote:
> On 04/07/2014 08:42 AM, Corinna Vinschen wrote:
> > On Apr  7 08:16, Eric Blake wrote:
> >> On 04/07/2014 02:47 AM, Corinna Vinschen wrote:
> >>
> >>>
> >>> There's no standard which restricts the sizes of the datatypes in
> >>> that way.  There's only this rule to follow:
> >>>
> >>>   sizeof (char) <= sizeof (short) <= sizeof (int) <= sizeof (long)
> >>
> >> Well, there IS the C rule that sizeof(char)==1, and also that char holds
> >>> = 8 bits, short holds >= 8 bits, int holds >= 16 bits, long holds >= 32
> >> bits.  There is also a POSIX rule that CHAR_BITS==8 (so while C allows a
> >> 9-bit or 32-bit char [and yes, such machines exist, although rare],
> >> POSIX does not allow that).
> > 
> > Apart from POSIX, where is that defined?
> 
> C99 5.2.4.2.1 Sizes of integer types <limits.h>
> 
> requires CHAR_BIT to be 8 or larger, UCHAR_MAX to be 255 or larger,
> USHRT_MAX to be 65535 or larger (oh, so I was wrong above; 8-bit short
> is not allowed), UINT_MAX to be 65535 or larger, ULONG_MAX to be
> 4294967295 or larger, and ULLONG_MAX to be 18446744073709551615 or larger.

C99 actually requires that?  Wow.  Modern times...

> > Xstormy16?
> 
> Okay, so maybe 16-bit machines aren't all museum pieces - but they also
> aren't portability targets for the majority of programs run on cygwin :)

Probably not, but I don't know a Cygwin application to control a
washing machine either :)


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: pgpwe4TyDVwTH.pgp
Description: PGP signature


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