bug? in turbo c++

Roger Gonzalez rg at msel.unh.edu
Thu Mar 7 03:37:33 AEST 1991


the following program demonstrates this "bug":
main()
{
    int     i;
    long    j;

    for (i = 0; i < 1000; i++, j = i*2)
        printf("oh crud: %x %10d %x\r", i, j, i);
}

The third number printed is always zero.  It corrects itself if the
second formatting string is %10ld.  Is this a new ansi-ism?  Will this
behavior change to what my Unix cc fingers expect if I set it to K&R?
Is it a bug?  I can see them arguing that it isn't a bug, but I find
it an unpleasant nonbug at the very least.

-Roger
-- 
"The question of whether a computer can think is no more interesting
 than the question of whether a submarine can swim" - Edsgar W. Dijkstra 
rg@[msel|unhd].unh.edu        |  UNH Marine Systems Engineering Laboratory
r_gonzalez at unhh.bitnet        |  Durham, NH  03824-3525



More information about the Comp.lang.c mailing list