Xref: utzoo comp.lang.c:35870 comp.os.msdos.programmer:3188 Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!att!dptg!ulysses!andante!alice!ark From: ark@alice.att.com (Andrew Koenig) Newsgroups: comp.lang.c,comp.os.msdos.programmer Subject: Re: Possible C compiler bug on 8086 machines Message-ID: <11794@alice.att.com> Date: 13 Jan 91 18:06:21 GMT References: <3577@bruce.cs.monash.OZ.AU> Reply-To: ark@alice.UUCP () Organization: AT&T Bell Laboratories, Liberty Corner NJ Lines: 19 In article <3577@bruce.cs.monash.OZ.AU> alanf@bruce.cs.monash.OZ.AU (Alan Grant Finlay) writes: > printf("This doesn't work : %d, %d\n",65536/512,512); > This doesn't work : 128, 0 > Is this a problem with my machine or the printf routine? It's probably a bug in your program. If your compiler stores ints in 16 bits, then 65536 is a long and 65536/512 is also a long. You should therefore do one of the following: printf("This should work : %d, %d\n", (int)(65536/512), 512); printf("This might also work : %ld, %d\n", 65536/512, 512); -- --Andrew Koenig ark@europa.att.com