>> Declaring "loopval" as volatile (and perhaps global, rather than on-stack, 
>> to 
>> reduce chances of compiler disregarding volatile declaration) might do the 
>> trick.

Yes, that should work if the compiler obeys volatile declarations.  Otherwise,
a store subterfuge will work too:

(a)     volatile int foo;

(b)     int foo;
        ...
        store(&foo);

        In another file:
        void store(int *x) { }

Both cases should force the compiler to load foo from memory, and
not optimize it away.

-------------------------------------------------------------------------------
- Nelson H. F. Beebe                    Tel: +1 801 581 5254                  -
- University of Utah                    FAX: +1 801 581 4148                  -
- Department of Mathematics, 110 LCB    Internet e-mail: [email protected]  -
- 155 S 1400 E RM 233                       [email protected]  [email protected] -
- Salt Lake City, UT 84112-0090, USA    URL: http://www.math.utah.edu/~beebe/ -
-------------------------------------------------------------------------------
_______________________________________________
Simh mailing list
[email protected]
http://mailman.trailing-edge.com/mailman/listinfo/simh

Reply via email to