Warren,
I just sent you a small test program with volatile. 
Actually, compilers will try very hard to optimize loops. In a cross 
platform product I am working on (for the past couple of years) we have an 
assembler language loop because they can't count on the C compilers to 
generate a predictable loop that can be used as a processor speed 
measurement. The code is built on virtually every major Unix system. 

Also, the volatile keyword does not tell the compiler not to optimize. It 
tells the compiler that the volatile variable must be saved after 
modification. Many compilers will leave the result in a register, and may 
never even allocate memory for a variable. In the non-volatile case, 
neither 'iterations' nor 'i' ever are stored in memory.  
On 2 May 2002 at 14:05, Warren Mansur wrote:
> 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.

--
Jerry Feldman <[EMAIL PROTECTED]>
Associate Director
Boston Linux and Unix user group
http://www.blu.org PGP key id:C5061EA9
PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9


*****************************************************************
To unsubscribe from this list, send mail to [EMAIL PROTECTED]
with the text 'unsubscribe gnhlug' in the message body.
*****************************************************************

Reply via email to