On 11/08/2015 04:01 PM, Ian Chapman wrote:
> Hi all,
> I'm having difficulty understanding this situation.
> flag = 1;
> while ( 0 != flag )
> {
> code;
> }
If flag is changed within an interrupt, it must be declared as volatile:
volatile int flag;
Otherwise the compiler will see that it never changes and optimize
accordingly.
--
David W. Schultz
http://home.earthlink.net/~david.schultz
Returned for Regrooving
------------------------------------------------------------------------------
_______________________________________________
Mspgcc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users