Created on 1999-05-04.00:00:00 last changed 157 months ago
[Moved to DR at 10/01 meeting.]
Proposed resolution (10/00):
Replace the portion of the note in 126.96.36.199 [dcl.array] paragraph 1 reading
such an array has internal linkage unless explicitly declared extern (188.8.131.52 [dcl.type.cv]) and must be initialized as specified in 9.4 [dcl.init].
see 6.8.4 [basic.type.qualifier].
Steve Clamage: Section 184.108.40.206 [dcl.array] paragraph 1 reads in part as follows:
Any type of the form "cv-qualifier-seq array of N T" is adjusted to "array of N cv-qualifier-seq T," and similarly for "array of unknown bound of T." [Example:The Note appears to contradict the sentence that precedes it.typedef int A, AA; typedef const A CA; // type is "array of 5 const int" typedef const AA CAA; // type is "array of 2 array of 3 const int"—end example] [Note: an "array of N cv-qualifier-seq T" has cv-qualified type; such an array has internal linkage unless explicitly declared extern (220.127.116.11 [dcl.type.cv] ) and must be initialized as specified in 9.4 [dcl.init] . ]
Mike Miller: I disagree; all it says is that whether the qualification on the element type is direct ("const int x") or indirect ("const A CA"), the array itself is qualified in the same way the elements are.
Steve Clamage: In addition, section 6.8.4 [basic.type.qualifier] paragraph 2 says:
A compound type (6.8.3 [basic.compound] ) is not cv-qualified by the cv-qualifiers (if any) of the types from which it is compounded. Any cv-qualifiers applied to an array type affect the array element type, not the array type (18.104.22.168 [dcl.array] )."The Note appears to contradict that section as well.
Mike Miller: Yes, but consider the last two sentences of 6.8.4 [basic.type.qualifier] paragraph 5:
Cv-qualifiers applied to an array type attach to the underlying element type, so the notation "cv T," where T is an array type, refers to an array whose elements are so-qualified. Such array types can be said to be more (or less) cv-qualified than other types based on the cv-qualification of the underlying element types.I think this says essentially the same thing as 22.214.171.124 [dcl.array] paragraph 1 and its note: the qualification of an array is (bidirectionally) equivalent to the qualification of its members.
Mike Ball: I find this a very far reach. The text in 126.96.36.199 [dcl.array] is essentially that which is in the C standard (and is a change from early versions of C++). I don't see any justification at all for the bidirectional equivalence. It seems to me that the note is left over from the earlier version of the language.
Steve Clamage: Finally, the Note seems to say that the declaration
volatile char greet = "Hello";gives "greet" internal linkage, which makes no sense.
Have I missed something, or should that Note be entirely removed?
Mike Miller: At least the wording in the note should be repaired not to indicate that volatile-qualification gives an array internal linkage. Also, depending on how the discussion goes, either the wording in 6.8.4 [basic.type.qualifier] paragraph 2 or in paragraph 5 needs to be amended to be consistent regarding whether an array type is considered qualified by the qualification of its element type.
Steve Adamczyk pointed out that the current state of affairs resulted from the need to handle reference binding consistently. The wording is intended to define the question, "Is an array type cv-qualified?" as being equivalent to the question, "Is the element type of the array cv-qualified?"
|2008-10-05 00:00:00||admin||set||status: wp -> cd1|
|2003-04-25 00:00:00||admin||set||status: dr -> wp|
|2002-05-10 00:00:00||admin||set||messages: + msg669|
|2001-11-09 00:00:00||admin||set||status: ready -> dr|
|2001-05-20 00:00:00||admin||set||status: drafting -> ready|
|2000-11-18 00:00:00||admin||set||messages: + msg418|
|2000-11-18 00:00:00||admin||set||status: open -> drafting|