Re: long_int vs int byte sizes

2014-04-08 Thread Corinna Vinschen
On Apr 8 11:41, Ross Smith wrote: > On 2014-04-08 03:51, Corinna Vinschen wrote: > >On Apr 7 09:39, Eric Blake wrote: > >> > >>C99 5.2.4.2.1 Sizes of integer types > >> > >>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

Re: long_int vs int byte sizes

2014-04-07 Thread Ross Smith
On 2014-04-08 03:51, Corinna Vinschen wrote: On Apr 7 09:39, Eric Blake wrote: C99 5.2.4.2.1 Sizes of integer types 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

Re: long_int vs int byte sizes

2014-04-07 Thread Corinna Vinschen
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

Re: long_int vs int byte sizes

2014-04-07 Thread Eric Blake
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 (sh

Re: long_int vs int byte sizes

2014-04-07 Thread Corinna Vinschen
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,

Re: long_int vs int byte sizes

2014-04-07 Thread Eric Blake
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 th

Re: long_int vs int byte sizes

2014-04-07 Thread Corinna Vinschen
On Apr 6 16:35, sisyph...@optusnet.com.au wrote: > -Original Message- From: Joseph Maxwell > > >[quote] > >int x = 0xAB78 in decimal format is : 43896 > >and > >unsigned int y = 0xAB78 in decimal format is : 43896 > >The size of int is 4 bytes > >[/quote] > > > >Not quite what I expected

Re: long_int vs int byte sizes

2014-04-07 Thread Csaba Raduly
On Sun, Apr 6, 2014 at 8:35 AM, Rob wrote: > I think so. I've not yet struck a case on Windows where either int or long > are not 4 bytes. (Haven't tried Cygwin64.) Obviously you never used a 16-bit compiler :) (where int is 16 bits and long is 32 bits usually) Csaba -- GCS a+ e++ d- C++ ULS$

Re: long_int vs int byte sizes

2014-04-05 Thread sisyphus1
-Original Message- From: Joseph Maxwell [quote] int x = 0xAB78 in decimal format is : 43896 and unsigned int y = 0xAB78 in decimal format is : 43896 The size of int is 4 bytes [/quote] Not quite what I expected, sine the leftmost bit in 'int' is 1 and would be the negative flag. No