Re: [c-prog] integer promotions

2008-11-22 Thread Tyler Littlefield
@yahoogroups.com Sent: Saturday, November 22, 2008 8:54 PM Subject: [c-prog] integer promotions If "The integer promotions preserve value including sign." #include int main (void) { unsigned short int a; unsigned long long int b, c; a = -1; b = (a*a); c = ((unsigned int)a

Re: [c-prog] integer promotions

2008-11-22 Thread Paul Herring
On Sun, Nov 23, 2008 at 3:54 AM, Pedro Izecksohn <[EMAIL PROTECTED]> wrote: > If "The integer promotions preserve value including sign." > > #include > > int main (void) { > unsigned short int a; > unsigned long long int b, c; > a = -1; > b = (a*a); Here you're multiplying two shorts. > c = ((un

[c-prog] integer promotions

2008-11-22 Thread Pedro Izecksohn
If "The integer promotions preserve value including sign." #include int main (void) { unsigned short int a; unsigned long long int b, c; a = -1; b = (a*a); c = ((unsigned int)a*(unsigned int)a); printf ("Why %llx != %llx ?\n", b, c); return 0; }