need volatile for asm?
David Brown
david@westcontrol.com
Wed Feb 16 12:12:00 GMT 2011
On 16/02/2011 11:59, Andi Hellmund wrote:
> > Would this be portable check, guaranteeing that compilation on other
> > machine with other gcc version will not do opposite ?
>
> You are right, this is definitely NOT portable
>
>> And anyway, why not always putting it to volatile ? Once you started
>> embedding asm code, I guess you had a good reason for it to appear in
>> the output code...
>
> Good point.
>
There are certainly times when you want to use embedded assembly, but
don't always want it to appear on the output code - then gcc's ability
to optimise and rearrange inline assembly is very nice. But this isn't
one of the cases :-)
More information about the Gcc-help
mailing list