Topic: Understanding a footnote in the standard


Author: SeeWebsiteForEmail@moderncppdesign.com ("Andrei Alexandrescu")
Date: Fri, 8 Aug 2003 03:23:37 +0000 (UTC)
Raw View
On page 9 of the standard, footnote 7 says:

"Note that some aspects of sequencing in the abstract machine are
unspecified; the preceding restriction upon side effects applies to that
particular execution sequence in which the actual code is generated."

I don't understand this sentence, could anyone illuminate me? Thanks.


Andrei


---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: rmaddox@isicns.com (Randy Maddox)
Date: Fri, 8 Aug 2003 14:40:43 +0000 (UTC)
Raw View
SeeWebsiteForEmail@moderncppdesign.com ("Andrei Alexandrescu") wrote in message news:<bgr99g$qfhn7$1@ID-14036.news.uni-berlin.de>...
> On page 9 of the standard, footnote 7 says:
>
> "Note that some aspects of sequencing in the abstract machine are
> unspecified; the preceding restriction upon side effects applies to that
> particular execution sequence in which the actual code is generated."
>
> I don't understand this sentence, could anyone illuminate me? Thanks.
>
>
> Andrei
>
>

Could it be a typo?  Taken in context with the text in which the
footnote is referenced it looks like this would make more sense if it
read:

"... particular execution sequence in the actual code which is
generated."


Randy.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: do-not-spam-benh@bwsint.com (Ben Hutchings)
Date: Fri, 8 Aug 2003 23:29:44 +0000 (UTC)
Raw View
In article <bgr99g$qfhn7$1@ID-14036.news.uni-berlin.de>,
"Andrei Alexandrescu" wrote:
> On page 9 of the standard, footnote 7 says:
>
> "Note that some aspects of sequencing in the abstract machine are
> unspecified; the preceding restriction upon side effects applies to that
> particular execution sequence in which the actual code is generated."
>
> I don't understand this sentence, could anyone illuminate me? Thanks.

The order of evaluation of function arguments, for example, is unspecified.
So if a function is called with several arguments whose evaluation involves
access to various volatile objects, the order of access to the volatile
storage[1] is dependent on this unspecified order of evaluation of the
arguments[2].  I think that's what the footnote means.

[1] "side effects"
[2] "the particular execution sequence in which the actual code is
    generated"

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: kuyper@wizard.net (James Kuyper)
Date: Fri, 8 Aug 2003 23:30:12 +0000 (UTC)
Raw View
SeeWebsiteForEmail@moderncppdesign.com ("Andrei Alexandrescu") wrote in message news:<bgr99g$qfhn7$1@ID-14036.news.uni-berlin.de>...
> On page 9 of the standard, footnote 7 says:
>
> "Note that some aspects of sequencing in the abstract machine are
> unspecified; the preceding restriction upon side effects applies to that
> particular execution sequence in which the actual code is generated."
>
> I don't understand this sentence, could anyone illuminate me? Thanks.

It means that any particular sequence that doesn't violate the
requirements of the standard is allowed. An implementation is free to
choose any one of the permitted sequences. Having chosen one of those
sequences, an implementation cannot produce side-effects in a way that
is detectably inconsistent with that chosen sequence. In some cases,
the permitted/required side-effects are detectably different for
different legal sequences.

Note: under the as-if rule, the actual sequence implmented by the
program doesn't have to be the same as the "chosen" sequence. It
doesn't even have to be a legal sequence. It just needs to produce the
same effects (and same side-effects) as the chosen sequence.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]