Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uunet!munnari.oz.au!goanna!ok From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) Newsgroups: comp.lang.c Subject: Re: bug? in turbo c++ Message-ID: <4924@goanna.cs.rmit.oz.au> Date: 7 Mar 91 06:41:53 GMT References: <1991Mar6.173733.430@unhd.unh.edu> Organization: Comp Sci, RMIT, Melbourne, Australia Lines: 21 In article <1991Mar6.173733.430@unhd.unh.edu>, rg@msel.unh.edu (Roger Gonzalez) writes: > int i; > long j; > printf("oh crud: %x %10d %x\r", i, j, i); > Is this a new ansi-ism? Nope, that's the way it was back when 'long' became available on PDP-11s. Always use "%d", "%x" and so on for "int". (PDP-11: 2 == sizeof (int)) Always use "%ld", "%lx" and so on for "long". (PDP-11: 4 == sizeof (long)) No need to worry about "char" or "short", as they promote to "int". > Will this > behavior change to what my Unix cc fingers expect if I set it to K&R? This *IS* what UNIX cc compilers require. You are confusing "machine where sizeof (int) == sizeof (long)" with "UNIX machine". 'Tisn't so. PDP-11s & Z8000s running UNIX had the same problem for the same reason. -- The purpose of advertising is to destroy the freedom of the market.