Last update February 22, 2008

Doc Comments /
Const Invariant



Const and Invariant

Comments

Add your comments in a section below...

Is this page out-of-date?

Is this const description now in sync with the current version of const in D2.011?

It doesn't seem to be in sync, because it starts off talking about using invariant to declare manifest constants.

based on 2008-02-21 post by Bill Baxter

String literals in C++98

In C++98 a string literal does not have type "const char *". See ISO/IEC 14882:1998(E), clause 2.13.4:

"A string literal is a sequence of characters (as defined in 2.13.2) surrounded by double quotes, optionally beginning with the letter L, as in "..." or L"...". A string literal that does not begin with L is an ordinary string literal, also referred to as a narrow string literal. An ordinary string literal has type “array of n const char” and static storage duration (3.7), where n is the size of the string as defined below, and is initialized with the given characters. A string literal that begins with L, such as L"asdf", is a wide string literal. A wide string literal has type “array of n const wchar_t” and has static storage duration, where n is the size of the string as defined below, and is initialized with the given characters."

Links

  • Corresponding page in the D Specification

FrontPage | News | TestPage | MessageBoard | Search | Contributors | Folders | Index | Help | Preferences | Edit

Edit text of this page (date of last change: February 22, 2008 21:34 (diff))