ANSII C, optimization, and "hardware registers"
Henry Spencer
henry at utzoo.UUCP
Sun Oct 14 09:27:14 AEST 1984
> [Compiler is optimizing out a wait-for-hardware-done loop.]
> ...
> 1. Was this legal code generation?
> 2. Note that this compiler did "simple" optimizations as part of the code
> generation. Is this legal?
As to whether it's legal by K&R, the only answer is "mumble". This
thorny issue was never addressed in the old days. The draft ANSI standard
has a "volatile" declaration that you can use to tell the compiler "don't
get tricky with this variable, it may change underfoot".
--
Henry Spencer @ U of Toronto Zoology
{allegra,ihnp4,linus,decvax}!utzoo!henry
More information about the Comp.lang.c
mailing list