MESSAGE
DATE | 2010-02-19 |
FROM | Ruben Safir
|
SUBJECT | Subject: [NYLXS - HANGOUT] C Programming and Modern Approach question
|
Hello Dr King,
I'm reviewing your text while assigning it for a class in NYC and my students and I are looking at an inconsistancy in the section on inmplicit type conversion. Your text in the first edition, on page 127 says that integer promotion promotes from
int -> unsigned int -> long -> unsigned long
Test this with GCC:
#include
long int x = -500; unsigned long int y = 100;
int main(){ y = x + y; printf("==> %li \n", y); return 0; }
The sign remains. If anything, the unsigned long sems to promote to signed. If this an error in the text, a change in the C standard, or percular to GCC
Ruben Safir -- http://www.mrbrklyn.com - Interesting Stuff ahttp://www.nylxs.com - Leadership Development in Free Software
|
|