above example just made sure, that the instructions used for loading data where not optimized. We did this:
// 1. load data from memory
// 2. disable interrupts
// 3. load another data from memory
But the compiler optimized it like that
// 1. load data from memory
// 2. disable interrupts
// 3. use some already loaded data from step 1.
And using already loaded data from before disabling interrupt would make the application do undesired stuff that can only hardly be found as it might only occur very rarely.
O.o oh.
Обсуждают сегодня