Re: GNU C keyword volatile, GNU compiler/optimizer and instruction re-ordering

"Mike Stump" <mrs@kithrup.com>
29 Sep 2002 16:59:10 -0400

          From comp.compilers

Related articles
GNU C keyword volatile, GNU compiler/optimizer and instruction re-or Arun@Winphoria.Com (Arun) (2002-09-19)
Re: GNU C keyword volatile, GNU compiler/optimizer and instruction nmm1@cus.cam.ac.uk (Nick Maclaren) (2002-09-20)
Re: GNU C keyword volatile, GNU compiler/optimizer and instruction re- mrs@kithrup.com (Mike Stump) (2002-09-29)
Re: GNU C keyword volatile, GNU compiler/optimizer and instruction re- fjh@cs.mu.OZ.AU (Fergus Henderson) (2002-10-13)
Re: GNU C keyword volatile, GNU compiler/optimizer and instruction r nmm1@cus.cam.ac.uk (Nick Maclaren) (2002-10-13)
Re: GNU C keyword volatile, GNU compiler/optimizer and instruction r toon@moene.indiv.nluug.nl (Toon Moene) (2002-10-13)
Re: Fortran volatile, was GNU C keyword volatile nmm1@cus.cam.ac.uk (Nick Maclaren) (2002-10-18)
Re: GNU C keyword volatile, GNU compiler/optimizer and instruction re- thp@cs.ucr.edu (2002-10-18)
| List of all articles for this month |

From: "Mike Stump" <mrs@kithrup.com>
Newsgroups: comp.compilers
Date: 29 Sep 2002 16:59:10 -0400
Organization: Kithrup Enterprises, Ltd.
References: 02-09-118 02-09-122
Keywords: optimize, C, comment
Posted-Date: 29 Sep 2002 16:59:10 EDT

Nick Maclaren <nmm1@cus.cam.ac.uk> wrote:
>Unfortunately, volatile is a complete mess.


I think this statement is overly pessimistic. I disagree entirely
with this assessment of volatile. I think it is clear what it means,
and it is useful. I think the C++ standard clarifies some points for
users that might not otherwise know what it means. I think it would
be possible to write down exactly what it means and add this to the
language standards, but such an undertaking absolutely must be done by
people that know what it means. The C++ standard almost got into
serious trouble trying to refine and fix volatile. Unfortunately all
the right people to do this weren't available to do the right job.
Fortunately disaster was averted.


>To a first approximation, the handling of volatile is implementation
>dependent


The C++ standard I think does a better job than the older C standard.
Newer C standards I think show improvement as well. Are they perfect,
no, much more could be written, more things be made clear.


>but there is no guarantee that the next one will do the same thing.


Again, this is misleading at best and just flat wrong at worse.


If people want better answers than these for their volatile question,
come over to the gcc list and ask them.
[I find that the main use of volatile is as a portable way to write
fundamentally unportable code like device drivers. -John]


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.