default '==' on structs

spir denis.spir at gmail.com
Thu Feb 3 11:19:09 PST 2011


On 02/03/2011 07:00 PM, Steven Schveighoffer wrote:
> On Thu, 03 Feb 2011 12:52:28 -0500, spir <denis.spir at 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



More information about the Digitalmars-d-learn mailing list