avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] GCC loop optimization and volatile data question


From: Larry Barello
Subject: [avr-gcc-list] GCC loop optimization and volatile data question
Date: Sun, 22 Apr 2001 10:55:00 -0700

When using variable to communicate between interrupt handlers and C code,
one needs to use the 'volatile' keyword so GCC doesn't optimize reading the
variable outside of any loops.

If the variable is "extern", does one still need to declare it volatile?

If the usage is thus:

extern int some_external_variable;
...
while (...)
{
    ...
    if (some_external_variable == 0)
        break;
}

do I need to declare 'some_external_variable' as volatile?

Thanks!




reply via email to

[Prev in Thread] Current Thread [Next in Thread]