Stan Lippman on String Literals in C++/CLI

Stan has posted an important entry that goes a long way in explaining how string literals work in C++/CLI. Check it out here:

The Type of a String Literal Revisited ...

To briefly review: In ISO-C++, the type of "Pooh" is const char[5]. There is no exact match of "Pooh" to any of the three instances of foo(). However, the trivial conversion of const char[5] to const char* represents a best match, and this is why (3) is invoked. There was no built-in notion of a string literal having any relationship to System::String.

And this was changed in the design of C++/CLI. Actually, it was changed twice, and that is the talking point of this entry – to explain why the initial change had to be further refined.

Comments (1)

  1. Nish says:

    Definitely one of Stan’s best entries so far – also gives us an insight into his personal mode of thinking 🙂

Skip to main content