Brilliant For-loop Bug
Hi Ben,
This is exactly what I’ve said in my first answer; the compiler will always try to optimize out all code that has no visible effect; adding some delays is not considered a visible effect as the compiler has no idea about the time taken by any operation, so reducing this time is considered a good optimization (that is the real objective of optimization, isn’t it?).
I have however to investigate why, when i is declared as volatile, the last loop is ignored, as the purpose of volatile is to force the compiler to do all actions requested on the variable, as it may have some side effect...
Bernard (Ac6)