[Info-vax] decrementing & for loops in C
JF Mezei
jfmezei.spamnot at vaxination.ca
Fri Jan 9 16:11:18 EST 2009
Bill Gunshannon wrote:
> In device control applications, something this is the primary use of
> Ada, how can the compiler know what the possible side effects of an
> operation are?
However, if you had code such as:
*thrust_reverser = 10 ;
*power_level = 20 ;
*thurst_reverser = 30 ;
*power_level = 50 ;
The compiler would likely eliminate the first 2 operatios alltogether
because no matter what you do, the outcome of the loop will always be
that the reverse will be at 30 and power at 50.
I suspect that the C compiler might have special # statements to ensure
optimizaions are not made in a block of code.
I can see when writing device drivers that it would be important to
deposit values in certain memory locations in the right order.
In the above case, it would be more likely that there would be code that
would ensure the thrust reverser operation has completed before
proceeding to increase thrust.
But in a device driver, you would really deposit thsoe values at the
speed of light.
More information about the Info-vax
mailing list