On Thu, 2 May 2002, Jerry Feldman wrote:
> It is virtually impossible with any kind of optimizing turned on to write a
> C code program with a loop like this.
> unsigned long
> loop(unsigned long iterations) {
> unsigned long i;
> for (i = 0; i < iterations; i++)
> ;
> return(i);
> }
> Most compilers (gcc, DECC, HP C, Sun) will convert this code to:
> return iterations;
>
I think all you need to do is as the volatile keyword to unsigned long
i. In fact, the point of volatile is to tell compilers not to optimize any
use of the variable.
Regards,
Warren
*****************************************************************
To unsubscribe from this list, send mail to [EMAIL PROTECTED]
with the text 'unsubscribe gnhlug' in the message body.
*****************************************************************