Loop overflow
Michael Hayes
m.hayes@elec.canterbury.ac.nz
Mon Oct 26 20:11:00 GMT 1998
Can anyone tell me how many iterations this loop should perform on a
32 bit machine? I cannot find my copy of the C standard and am
wondering if this is allowed to be implementation specific due to
possible overflow. loop_iterations considers this to be an immediate
loop which I don't think is correct.
int
f()
{
int j = 1;
long i;
for (i = 0x7ffffff0L; i <= 0x7fffffffL; i += 1) j++;
return j;
}
Michael.
More information about the Gcc
mailing list