string literals

bearophile bearophileHUGS at lycos.com
Fri May 31 08:32:43 PDT 2013


Jack Applegame:

> What's the reason that the string literal is a dynamic array, 
> not a static?

Originally it was a fixed sized array. But in most cases you want 
a dynamic array.

Rust language forces you to specify where to allocate the string 
literal with a symbol before the string, as ~"hello". In D they 
have chosen a simpler solution, defaulting to dynamic.

This enhancement is meant to lessen the problem a little:
http://d.puremagic.com/issues/show_bug.cgi?id=481

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list