[Top][All Lists]

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

Re: [avr-gcc-list] avr-g++ local variable constructor / block body / des

From: Andy Parkins
Subject: Re: [avr-gcc-list] avr-g++ local variable constructor / block body / destructor execution order
Date: Fri, 31 Aug 2007 16:06:57 +0100
User-agent: KMail/1.9.7

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

Attachment: signature.asc
Description: This is a digitally signed message part.

reply via email to

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