Possible C compiler bug on 8086 machines

Alan Grant Finlay alanf at bruce.cs.monash.OZ.AU
Sat Jan 12 17:54:14 AEST 1991


The following program demonstrates a printf that doesn't seem to work
properly when compiled using a variety of C compilers for an 8086 machine.
The program is as follows:
-----------------------------//---------------------------

#include <stdio.h>

main()
{
   int x,y;
   x = 65536/512;
   y = 512;
   printf("This works : %d, %d\n",x,y);
   printf("This doesn't work : %d, %d\n",65536/512,512);
}

----------------------------//------------------------------

And here is a sample output: 

This works : 128, 512
This doesn't work : 128, 0

Does anyone have any idea why?
Is this a problem with my machine or the printf routine?



More information about the Comp.lang.c mailing list