Topic: Defect Report: basic exec. char. set, value of decimal digit.


Author: "Markus Mauhart" <mmauhart@ping.at>
Date: 1999/09/27
Raw View
 [Moderator's note: this defect report has been forwarded to
 the C++ committee.  -moderator (fjh).]

22.2.1.1.2 implies requirenments on the values of the decimal digits
{0,1,2,3,4,5,6,7,8,9} when taken as members of the basic execution
character set.  Contrary in 2.2, [lex.charset], this requirenments are
not listed, while other requirenments are listed but otherwise the
values are called "implementation defined".

Proposed solution:
In 2.2, par. 3, after the sentence "For each basic execution character
set, the values of the members shall be non-negative and distinct from
one another.", insert the following sentence:

 Additionally, for each two members representing decimal numbers
 (0,1,2,3,4,5,6,7,8,9), the difference of these members values is equal
 to the arithmetic difference of their corresponding numbers, i.e.
 value(character(n))-value(character(m)) == n-m.


Rationale:

To avoid potential misunderstandings: I do not claim that the standard
has a logical defect nor do I intend do introduce new or changed semantices
to the current standard. Instead, from my interpretation of 22.2.1.1.2 and
confirming postings I deduce that my proposed addition to 2.2 states a
requirenment yet present and intended in the standard. But IMO it is intended
to find this information in 2.2 together with the other description of the
basic execution character set.

1st, I assume that the requirenments expressed in my proposed addition
are in fact implied by other parts of the current standard:

The following sentence is taken from 22.2.1.1.2 ("ctype virtual
functions"), par 13:
  "In addition, for any digit character c, the expression
  (do_narrow(c,dfault)-'0')" "evaluates to the digit value of the
  character."

I posted the following question to comp.std.c++:
Does the cited sentence (together with some other parts of the
standard) imply the trueth of (('i'-'0' == i) && ('i'=='0'+i) for all i
in {0,1,2,3,4,5,6,7,8,9}) ?  In other words, the members
{0,1,2,3,4,5,6,7,8,9} of the basic execution character set have numeric
values 'constant + i' which aplies both for their corresponding
character literals 'i' and when represented in an char-object ?

Til today I have only found confirming reactions for this
question/conjecture, hence I consider it as true.

2nd, IMO 2.2 is intended to contain such information about values of
members of the basic execution character set.

3rd, actually adding the proposed information to 2.2 probably does
change the semantic for freestanding implementations which are not
required to provide <locale>. Hence IMHO the proposed addition is
either a 'new feature' or a correction for a present 'feature'.
---
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html              ]