What exactly are the String literrals in D and how they work?
rempas
rempas at tutanota.com
Sun Aug 15 09:11:35 UTC 2021
On Sunday, 15 August 2021 at 09:06:14 UTC, Mike Parker wrote:
>
> The D `string` is an alias for `immutable(char)[]`, immutable
> contents of a mutable array reference (`immutable(char[])`
> would mean the array reference is also immutable). You don't
> want to assign that to a `char*`, because then you'd be able to
> mutate the contents of the string, thereby violating the
> contract of immutable. (`immutable` means the data to which
> it's applied, in this case the contents of an array, will not
> be mutated through any reference anywhere in the program.)
>
> [...]
Thanks a lot for the info!
More information about the Digitalmars-d-learn
mailing list