Path: utzoo!attcan!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!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 Message-ID: <1990Feb21.204744.560@agate.berkeley.edu> Date: 21 Feb 90 20:47:44 GMT References: <8910270333.AA14741@cscwam.UMD.EDU> <0927891128429423@thelake.UUCP> <1990Feb14.173746.28244@agate.berkeley.edu> <1302@lzsc.ATT.COM> <1990Feb19.092139.3131@pcsbst.pcs.com> Sender: usenet@agate.berkeley.edu (USENET Administrator;;;;ZU44) Organization: University of California, Berkeley Lines: 24 roland@cochise.pcs.com (Roland Rambau) writes: >hcj@lzsc.ATT.COM (HC Johnson) writes: >->> > #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 >->K&R specify that constants are int's. Not a long int. Like I said "MAX is not a number, its an expression." There is an integer in the expression (the number 32768). But there is also an operator (the unary minus). This makes MAX an expression, not a number. Thus the real question is what does K&R say integer expression are evaluated to? I don't have K&R handy, but I believe it says long ints. Eric ericco@ssl.berkeley.edu Eric ericco@ssl.berkeley.edu