Hi Ian,
> Thanks guys I knew that I could count on you all for help. volatile,
> that's new to me I'll look it up. Kernighan and Ritchie say what you
> all say but ANSI C says it's implementation dependent, as long as it
> works.
FYI: ANSI C is also out of date. These days it is the ISO C99 sta
On 11/08/15 17:25, Daniel Beer wrote:
Thanks guys I knew that I could count on you all for help. volatile,
that's new to me I'll look it up. Kernighan and Ritchie say what you
all say but ANSI C says it's implementation dependent, as long as it
works. Thanks Ian.
> On Sun, Nov 08, 2015 at 05:0
On Sun, Nov 08, 2015 at 05:01:34PM -0500, Ian Chapman wrote:
> Hi all,
> I'm having difficulty understanding this situation.
> flag = 1;
> while ( 0 != flag )
> {
> code;
> }
> generates strange assembly code till I commented out
> // flag = 1;
> it looked to me like the optimizer realized
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 n
"flag" should be marked volatile, otherwise the optimiser may see it never
changes inside the body of the loop and omit checking the flag entirely.
- Wayne
> On 9 Nov 2015, at 08:01, Ian Chapman wrote:
>
> Hi all,
> I'm having difficulty understanding this situation.
> flag = 1;
> while (