On 02/03/2011 07:00 PM, Steven Schveighoffer wrote:
On Thu, 03 Feb 2011 12:52:28 -0500, spir <denis.s...@gmail.com> wrote:


Side-questions: is it written somewhere dmd interns string literals? If yes,
where? Is this supposed to be part of D's spec or an implementation aspect of
dmd?

String literals are immutable, which means the compiler is free to re-use them
wherever it wants without repercussions (you can't change immutable data).

It's not documented, but it fits within the requirements.

One thing that *is* documented is that string literals always have an implicit
0 character appended to the end of them, to allow easy interaction with C.


Right, thank you again, Steve.
An additional issue, then, is that this makes struct '==' compare inconsistent in front of literal vs non-literal string members (and literal strings vs all other arrays, in fact).

Denis
--
_________________
vita es estrany
spir.wikidot.com

Reply via email to