#17884 - xadeu - Tue Mar 16, 2004 4:17 pm
What is the meaning of volatile and how does it effect the GBA Hardware?
Basically why is it needed in GBA Programming...I haven't ever used it before in my programs.
#17885 - Gopher - Tue Mar 16, 2004 4:22 pm
volatile means that the variable's value might be changed outside your code. Specifying a variable or expression as Volatile prevents the compiler from trying to optimize your code by pre-evaluating it once. I.e., if you didn't define the joypad input register to volatile and you did a loop watching for a button press, the optimizer can tell that your code doesn't change that register, and it might try to test once before your loop instead of repeating the test inside the loop.
_________________
"Only two things are infinite: the universe, and human stupidity. The first is debatable." -Albert Einstein