comp.lang.ada
 help / color / mirror / Atom feed
From: robert_dewar@my-dejanews.com
Subject: Re: Handling Addressing Errors
Date: 1999/03/19
Date: 1999-03-19T00:00:00+00:00	[thread overview]
Message-ID: <7csogm$4s5$1@nnrp1.dejanews.com> (raw)
In-Reply-To: 1999Mar18.005620.19189@nosc.mil

In article <1999Mar18.005620.19189@nosc.mil>,
  claveman@fern.com (Charles H. Sampson) wrote:
>
> By my reading, even pragma Volatile doesn't help,
> because C.6(10)
> only says that all reads are performed directly to
> memory.  It doesn't
> say that the read must be performed even if it is known
> that the value
> is not used.  I think it's well beyond the LRM to say
> that a read of a
> volatile object might have some effect in addition to
> obtaining its
> value and, therefore, all reads must be performed whether
> the value is
> needed or not.

No, that is just a wrong reading, and it is NOT worth
arguing the delicate semantics of the wording, since
everyone knows what is intended here. I guess as a low
priority task the ARG could worry about defending the
RM from Charles' obviously incorrect reading, but
changing the language in the RM will not make one tiny
little bit of difference in real life.

THe whole POINT of volatile is to make sure that every
read and write happens from memory. AN optimizer that
eliminates a volatile read or write is broken!

One important rule in reading the RM is that you must not
ignore the unstated very important rule:

  "No other rule in this manual can be used to derive a
   silly conclusion."

Basically what this means is that if you sit down and try
to read the RM in a hostile manner, you may discover cases
in which the wording could be improved, but that does not
mean these are cases where compilers will do the wrong
thing.

For example, it is 100% clear in the original Ada 83
RM that

  subtype x is integer range 1 .. 10;

defines a non-static subtype. But of *course* all compilers
treated this as a static subtype, since that is the obvious
intent.

Similarly the obvious intent of volatile is that it means
that all reads and writes happen and that they happen to
memory (one very important use of volatile is for example
mapping to memory mapped I/O devices and everyone knows
this).

I am not saying all cases are clear cut.

But this one is definitely an example of one that is
indeed clear cut.

In any case, and especially if you do not agree, you should
follow the directions in the RM

59   Informal comments on this International Standard may
be sent via e-mail
to ada-comment@sei.cmu.edu.  If appropriate, the Project
Editor will initiate
a Technical Corrigendum to be issued for the standard.


and let the ARG look at it :-)

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




  parent reply	other threads:[~1999-03-19  0:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-03  0:00 Handling Addressing Errors Charles H. Sampson
1999-03-04  0:00 ` robert_dewar
1999-03-18  0:00   ` Charles H. Sampson
1999-03-18  0:00     ` Tucker Taft
1999-03-19  0:00       ` Mikko Levanto
1999-03-19  0:00         ` Nick Roberts
1999-03-20  0:00         ` Tucker Taft
1999-04-02  0:00       ` Charles H. Sampson
1999-03-18  0:00     ` Nick Roberts
1999-03-21  0:00       ` robert_dewar
1999-03-19  0:00     ` robert_dewar [this message]
1999-03-04  0:00 ` Nick Roberts
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox