On 11/16/06, James Carlson <[EMAIL PROTECTED]> wrote:
... and that proves that it works with C99, but not with C++.

It should work with C++ when CC is passed -xlang=c99 (as a compiler
extension), but it will violate ISO/IEC:14882:2003:8.3.4 and
ISO/IEC:14882:2003:5.19.

ISO/IEC:14882:2003:8.3.4:

In a declaration <T><D> where <D> has the form:

D1[<constant-expression(opt)]

and the type of the identifier in the declaration <T><D1> is
"derived-declarator-type-list <T>," then the type of the identifier of
<D> is an array type. [ ... ] If the <constant-expression>(5.19) is
present, it shall be an integral constant expression and its value
shall be greater than zero. [ ... ]

ISO/IEC:14882:2003:5.19:

In several places, C++ requires expressions that evaluate to an
integral or enumeration constants: as array bounds (8.3.4, 5.3.4), as
<case> expressions (6.4.2) as bit-field lengths (9.6), as enumerator
initializers (7.2), as static member initializers (9.4.2), and as
integral or enumeration non-type template arguments (14.3). [ ... ]

An <integral-constant-expression> can involve only literals (2.13),
enumerators, <const> variables or static data members of integral or
enumeration types initialized with constant expressions (8.5),
non-type template parameters of integral or enumeration types, and
<sizeof> expressions. Floating literals (2.13.3) can appear only if
they are cast to integral or enumeration type. [ ... ]

--Stefan

--
Stefan Teleman
[EMAIL PROTECTED]
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to