Question about @nogc in D 2.066

Dicebot via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jul 11 13:39:19 PDT 2014


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.


More information about the Digitalmars-d-learn mailing list