Key difference is that type of string literal is
immutable(char)[] so it is perfectly legal to keep it in binary
text segment. Type of array literal is just T[] (int[] here) and
you can possibly mutate their elements. Because of this each
assignment of array literal needs to allocate a new copy contrary
to immutable strings which can all reference same memory chunk.
- Question about @nogc in D 2.066 Weasel via Digitalmars-d-learn
- Re: Question about @nogc in D 2... Adam D. Ruppe via Digitalmars-d-learn
- Re: Question about @nogc in D 2... Dicebot via Digitalmars-d-learn
- Re: Question about @nogc in... Timon Gehr via Digitalmars-d-learn
- Re: Question about @nog... Dicebot via Digitalmars-d-learn
- Re: Question about @nogc in D 2... Trass3r via Digitalmars-d-learn