On Apr 6 16:35, sisyphus1@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, 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.) On x86_64 Cygwin, sizeof (long) == 8. See http://cygwin.com/faq/faq.html#faq.programming.64bitporting > Certainly, on some other systems, int is 4 bytes and long is 8 bytes. > The standards permit both configurations. 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) Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat