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


-----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 - 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.

Cheers,
Rob



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


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