Assigning global and static associative arrays

Jonathan M Davis jmdavisProg at gmx.com
Sat Sep 1 11:10:17 PDT 2012


On Saturday, September 01, 2012 16:14:29 ixid wrote:
> Those still have different addresses when made immutable too, is
> this something that could be optimized for all immutable enums to
> behave like strings or are there reasons to keep them unique at
> each instance?

The compiler has to got to extra work to make string literals use the same 
memory like that. While it _could_ do the same with other array literals of 
basic types, it's not worth it, because they're just not used enough, whereas 
string literals get used all over the place.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list