weird C behavior
Chris Torek
chris at umcp-cs.UUCP
Sun Mar 23 01:23:21 AEST 1986
In article <557 at utastro.UUCP> nather at utastro.UUCP (Ed Nather) writes:
>Here is a short C program which gives correct output according to K & R.
>[...] Try it on *your* 16-bit computer.
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)
Too bad lint does not catch the printf() type bug.
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1415)
UUCP: seismo!umcp-cs!chris
CSNet: chris at umcp-cs ARPA: chris at mimsy.umd.edu
More information about the Comp.lang.c
mailing list