Defect Report #039

Submission Date: 10 Dec 92
Submittor: WG14
Source: X3J11/91-061 (Vania Joloboff)
Question 1
My interpretation of the Standard is that the value of MB_CUR_MAX must be one in the "C" locale. I infer that from the fact that:

  1. The characters in the "C" locale must be alphanumeric + space.
  2. The isXXX functions specify character constant values for the "C" locale.
  3. A character constant consists of one or more characters that are enclosed within apostrophes. A character is regarded as having type char.
  4. The data type char consists of one byte of storage.

However this clarification should be made explicit.
Response
In fact 3, we presume the second sentence was intended to be: ``A character constant is regarded as having type char,'' in order to be applicable to this request. That is not true; a character constant is of type int. Also facts 1-4 deal with the single-byte chars and not the extended character set.
In any case, the facts as listed do not logically lead to the conclusion that MB_CUR_MAX must be one (1) in the "C" locale. In fact, this conclusion is not true. It is possible for MB_CUR_MAX to be greater than one in the "C" locale. In subclause 7.10, page 149, MB_CUR_MAX is ``the maximum number of bytes in a multibyte character for the extended character set specified by the current locale.'' In subclause 7.4.1.1, page 107, the "C" locale is ``the minimal environment for C translation.'' The minimal environment may still require more than one byte for multibyte characters.
Question 2
I also would like to make a requirement that if the current locale is the "C" locale, the value returned by setlocale(LC_ALL, NULL) be a string of length one, consisting of the single character C.
Currently the value of setlocale(LC_ALL, NULL) is unspecified for the "C" locale.
This makes it difficult to build libraries where you want to maintain the behavior pre-existing to internationalization for backward compatibility.
Typically you want to say in these programs:
if (*setlocale(LC_ALL, NULL) == 'C')
do the old thing
else
do the new thing
Response

The reference is to subclause 7.4.1.1, page 107.
The Committee acknowledges that there exists no strictly portable method for determining whether the current locale is the "C" locale. The request for this feature is neither an erratum nor a request for interpretation; it is a request for an amendment. The Committee will consider this request for a future revision of the C Standard.

Previous Defect Report < - > Next Defect Report