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 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: GNU C keyword volatile, GNU compiler/optimizer and instruction re- thp@cs.ucr.edu (2002-10-18) |
From: | "Nick Maclaren" <nmm1@cus.cam.ac.uk> |
Newsgroups: | comp.compilers |
Date: | 13 Oct 2002 15:54:18 -0400 |
Organization: | University of Cambridge, England |
References: | 02-09-118 02-09-122 02-09-170 |
Keywords: | optimize, C |
Posted-Date: | 13 Oct 2002 15:54:18 EDT |
Mike Stump <mrs@kithrup.com> wrote:
>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.
Hmm. Well, having been an active member of the BSI C Panel during
both the C90 and C99 public comment periods, I can tell you that the
working group did not agree with what it should mean, let alone
whether the wording made this clear.
If you are serious, then I suggest that you write a clear description
in standardese and submit it to the working group. Plenty of people
on that have tried doing what you say, and so far failed.
>>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.
The C++ working group aren't desperately happy with their wording,
either, and there were no significant changes between C90 and C99.
>>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.
You might like to ponder the question of why there is no document that
specifies precisely what it means, or even what gcc means by it, if
the issue is so clear and stable.
>[I find that the main use of volatile is as a portable way to write
>fundamentally unportable code like device drivers. -John]
Semi-portable, please! But, yes. I tried using it as a way of doing
the same for exception handling (involving signals and all that), and
discovered that it was a positive nightmare. I discovered what I
thought had to be code generation errors in several compilers, and
posted them to the C reflector. The response was to provide me with
the information I have summarised above.
Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QH, England.
Email: nmm1@cam.ac.uk
Tel.: +44 1223 334761 Fax: +44 1223 334679
Return to the
comp.compilers page.
Search the
comp.compilers archives again.