Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site alice.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!alice!ark From: ark@alice.UucP (Andrew Koenig) Newsgroups: net.lang.c,net.micro,net.micro.pc Subject: Re: weird C behavior Message-ID: <5190@alice.uUCp> Date: Thu, 27-Mar-86 09:52:59 EST Article-I.D.: alice.5190 Posted: Thu Mar 27 09:52:59 1986 Date-Received: Fri, 28-Mar-86 07:46:32 EST References: <330@hadron.UUCP> Organization: Bell Labs, Murray Hill Lines: 27 Xref: watmath net.lang.c:8284 net.micro:14145 net.micro.pc:7562 >>The code contains the following [paraphrased]: >> printf("%d\n", 36864); >>On a 16 bit machine, this should read >> printf("%ld\n", 36864); >>One alternative is to change Ed's original program to read >> #define BIG ((int) 36864) > Passed arguments should always be passed as an "int", I do believe. Absolutely not! Are you really suggesting there's no way to pass a long integer to a function? The following are correct: printf("%d\n", 1); printf("%ld\n", 1L); /* long constant */ printf("%ld\n", (long) 1); /* long constant expression */ The following are incorrect: printf("%d\n", 1L); printf("%ld\n", 1); printf("%d\n", (long) 1); This one is correct on some machines but not on others: printf("%d\n", 36864); because 36864 is an int on some machines and a long on others.