Topic: The one thing I would change about the standard


Author: "Claus Hirth" <claus.hirth@swissonline.ch>
Date: Sun, 9 Sep 2001 12:43:32 GMT
Raw View
If I could change only one thing about the current C++ standard, I would
introduce the following requirement:

<REQUIREMENT>
For every statement or formulation F in the standard that is kept abstract
to the end of keeping C++ as a language platform indepent, any compliant
implementation must provide a concrete reformulation scoped to the concrete
target platform the implementation supports. The concrete reformulation must
appear as a "platform amendment" to the rule containing F.
</REQUIREMENT>

To illustrate, for each target platform and C++ implementation the compiler
vendor would have to produce a document that looks just like the current C++
standard, yet there would be platform amendments to rules that contain
multi-platform issues.

A programmer that doesn't have platform issues could just refer to the
"concrete standard" delivered with his implementation, which would be easier
to read and understand. So he could get his work done more easily. Of course
he would still need the current C++ standard so he can check his concrete
standard against it, in case of doubt or when he needs to think about other
platforms.

I am looking forward to a hear of any points you would like to make.

    claus.hirth@swissonline.ch


---
[ 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.research.att.com/~austern/csc/faq.html                ]





Author: Greg Chicares <chicares@mindspring.com>
Date: Sun, 9 Sep 2001 22:04:11 GMT
Raw View
Claus Hirth wrote:
>
> If I could change only one thing about the current C++ standard, I would
> introduce the following requirement:
>
> <REQUIREMENT>
> For every statement or formulation F in the standard that is kept abstract
> to the end of keeping C++ as a language platform indepent, any compliant
> implementation must provide a concrete reformulation scoped to the concrete
> target platform the implementation supports. The concrete reformulation must
> appear as a "platform amendment" to the rule containing F.
> </REQUIREMENT>

The standard already requires documentation of implementation-
defined behavior.

  1.3.5 implementation-defined behavior [defns.impl.defined]
    behavior, for a well-formed program construct and correct
    data, that depends on the implementation and that each
    implementation shall document.

For instance, the documentation provided with my borland
compiler refers to specific sections of the standard
(as it stood when this elderly compiler was sold), e.g.

  2.2.1  Members of the source and execution character sets.
  The source and execution character sets are the extended
  ASCII set supported by the IBM PC. Any character other than
  Ctrl+Z can appear in string literals, character constants,
  or comments.

Undefined behavior is another matter altogether. 1.3.12 says

    permissible undefined behavior [includes] behaving during
    translation or program execution in a documented manner
    characteristic of the environment

but of course any other behavior is allowed too. Documenting
a particular behavior in such a case is harmful in that some
programmers will rely on it, and learn and write a nonstandard
dialect.

> To illustrate, for each target platform and C++ implementation the compiler
> vendor would have to produce a document that looks just like the current C++
> standard, yet there would be platform amendments to rules that contain
> multi-platform issues.

Putting aside copyright problems, this is harmful because
some programmers will take one compiler's amended standard
as the actual standard. Once this process starts, it is all
too easy for a vendor that dominates a particular market to
change the standard materially, by documenting its chosen
behavior where that differs from the real standard--perhaps
without mentioning the difference, and perhaps where the
chosen behavior even contradicts the standard.

Probably that is not what you intend by

> every statement or formulation [...] kept abstract
> to the end of keeping C++ as a language platform indepent

but I fear that some vendors might take this proposal as
license to undermine the standard.

---
[ 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.research.att.com/~austern/csc/faq.html                ]