Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uunet!ogicse!pdxgate!eecs!mwizard From: mwizard@eecs.cs.pdx.edu (Craig Nelson) Newsgroups: comp.lang.c Subject: Re: bug? in turbo c++ Message-ID: <1906@pdxgate.UUCP> Date: 11 Mar 91 08:38:55 GMT References: <1991Mar6.171424.17409@nntp-server.caltech.edu> <1991Mar6.173733.430@unhd.unh.edu> <1991Mar10.153011.499@dce.ie> Sender: news@pdxgate.UUCP Lines: 33 ch@dce.ie (Charles Bryant) writes: >In article <1991Mar6.173733.430@unhd.unh.edu> rg@msel.unh.edu (Roger Gonzalez) writes: >>main() >>{ >> int i; >> long j; >> >> for (i = 0; i < 1000; i++, j = i*2) >> printf("oh crud: %x %10d %x\r", i, j, i); >>} >Surely I am not the only person to notice that j is used before being >set? (On the first pass only). Maybe our newsfeed is just clogged. >-- >Charles Bryant (ch@dce.ie) No, you're not the only one. I wonder if he tried this instead, and then check for his 'bug': main() { int i=0;j=0; for (;i<1000;i++,j=i*2) printf("oh crud: %x %10d %x\r", i, j, i); } Also, I was always under the impression that long defaulted to an integer format (a long one). I wonder why he is trying to format it to a double format in the printf() statement ? Craig Nelson (mwizard@eecs.ee.pdx.edu)