This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: Gcc and the volatile keyword
- From: Andrew Lunn <andrew at lunn dot ch>
- To: Chuck McManis <cmcmanis at mcmanis dot com>
- Cc: ECOS Discussion Group <ecos-discuss at sources dot redhat dot com>
- Date: Thu, 16 Feb 2006 10:00:07 +0100
- Subject: Re: [ECOS] Gcc and the volatile keyword
- References: <6.1.0.6.0.20060215141438.01d8e778@66.125.189.29>
> Would that insure that values would not be left in the registers?
>
> And on a more global note, I've already told the HAL to allocate this
> memory out of uncached memory space so if I'm not spin looping on these
> values do I even need volatile?
volatile means more than just do not use a register. It also ensures
the compiler does not change the order of operations and it does not
combine operations on the same variable or throw away apparently
useless statements.
In summary, keep the volatile.
Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss