This is the mail archive of the
mailing list for the Cygwin project.
Re: long_int vs int byte sizes
- From: <sisyphus1 at optusnet dot com dot au>
- To: "Joseph Maxwell" <discard36 at gmail dot com>, <cygwin at cygwin dot com>
- Date: Sun, 6 Apr 2014 16:35:47 +1000
- Subject: Re: long_int vs int byte sizes
- Authentication-results: sourceware.org; auth=none
- References: <CABKp57PdLMKqmGFhfMEN4BLPFcndkpibora5yx2Xdy6zh4+WzA at mail dot gmail dot com>
From: Joseph Maxwell
int x = 0xAB78 in decimal format is : 43896
unsigned int y = 0xAB78 in decimal format is : 43896
The size of int is 4 bytes
Not quite what I expected, sine the leftmost bit in 'int' is 1 and
would be the negative flag.
No - the full 32-bit representation of 0xAB78 is:
0000 0000 0000 0000 1010 1011 0111 1000
The leftmost bit is zero.
Note size of int and long int are the same both are 4 bytes long
Is this to be expected?
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.)
Certainly, on some other systems, int is 4 bytes and long is 8 bytes.
The standards permit both configurations.
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple