Path: utzoo!attcan!uunet!wuarchive!uwm.edu!bionet!agate!stew.ssl.berkeley.edu!ericco From: ericco@stew.ssl.berkeley.edu (Eric C. Olson) Newsgroups: comp.sys.atari.st Subject: Re: Bug in TURBO-C V1.0 Summary: not really Message-ID: <1990Feb14.173746.28244@agate.berkeley.edu> Date: 14 Feb 90 17:37:46 GMT References: <8910270333.AA14741@cscwam.UMD.EDU> <0927891128429423@thelake.UUCP> Sender: usenet@agate.berkeley.edu (USENET Administrator;;;;ZU44) Organization: University of California, Berkeley Lines: 22 >Look at this C-code: > #define MAX -32768 > main() > { > printf("1: %d\n", MAX); > printf("2: %d\n", (int)MAX); > } This is not a bug, its a feature. MAX is not a number, its an expression. Thus, the evaluation of MAX is a long int. The first printf only prints the high word of the long int MAX. The second printf properly casts the long int to an int and prints the correct result. Try: printf("3: %ld\n", MAX); Eric ericco@sag4.ssl.berkeley.edu Eric ericco@ssl.berkeley.edu