Path: utzoo!attcan!uunet!mcvax!enea!kth!osiris!sics.se!pk-tle From: pk-tle@sics.se (Tommy Levitte) Newsgroups: comp.lang.c Subject: Turbo C bug ! Message-ID: Date: 21 Jan 89 09:32:47 GMT Sender: news@osiris.sics.se Distribution: comp Organization: Swedish Institute of Computer Science, Kista Lines: 43 Hrmm... I think I found a bug in Turbo C 2.0 . The funny thing is it didn't exist in earlier versions! This tiny program shows it --- #define X 240 #define Y 240 #define Z ((X)*(Y)) void fn(unsigned long i) { printf("%ld %ul\n",i,i) } main() { fn(Z); } ----- Running this gave me a nice surprise: -7936 2147475712 But if I change fn(Z) with fn(57600), it gives me the right numbers: 57600 57600 (57600 = 240*240 !!!!!!!) This gave me problems when I gave exactly that kind of define to malloc() !!! Fix : Put an L at the end of 240 !!!! -- Tommy Levitte pk-tle@draken.nada.kth.se pk-tle@sics.sics.se gizmo@kicki.stacken.kth.se