[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] avr-g++ local variable constructor / block body / des
Re: [avr-gcc-list] avr-g++ local variable constructor / block body / destructor execution order
Fri, 31 Aug 2007 16:06:57 +0100
On Friday 2007 August 31, Oleksandr Redchuk wrote:
> volatile uint32_t counter;
> gcc 4.x produces expected code, but, I think, "volatile" is not
> required in this code.
I'm not sure; I think volatile is exactly what's needed, otherwise gcc is
allowed to assume that the value won't change apart from under its control
and hence can safely reorder instructions (which is what it does). The fact
that you've wrapped it in a cli() is what lets you access that volatile
variable safely - it's still volatile though.
Dr Andy Parkins, M Eng (hons), MIET
Description: This is a digitally signed message part.