how to cast away 'volatile'?

Andrew Haley aph@redhat.com
Wed Mar 14 15:17:00 GMT 2007


Matthew Woehlke writes:
 > Andrew Haley wrote:
 > > Matthew Woehlke writes:
 > >> So far no one has successfully answered my original question; how do I 
 > >> suppress these dang warnings? :-)
 > > 
 > > I did.  Maybe you didn't see it, or maybe you didn't like the
 > > suggestion.
 > 
 > "Didn't see it"? I just re-read your posts; the only thing I see that 
 > might be a suggestion is "don't use volatile". So if there was something 
 > else, I must apologize, because I'm not finding it. :-)

I suggested keeping a non-volatile pointer (to the alloc'd memory) and
a volatile pointer to the same memory, and using whichever was
appropriate.  I still think that's a good idea.  The warning from gcc
*is* correct: you're casting away volatile.  Sure, you might be able
to find a way to shut up the warning, but is it not surely better to
fix the code instead?

Andrew.



More information about the Gcc-help mailing list