string types: const(char)[] and cstring
Walter Bright
newshound1 at digitalmars.com
Mon Jun 4 02:28:21 PDT 2007
Bruno Medeiros wrote:
> Walter Bright wrote:
>> Derek Parnell wrote:
>>> What is the syntax for an immutable array of mutable characters?
>>
>> There isn't one. Such a construct is appealing in the abstract, but I
>> haven't run across a legitimate use for it yet.
>
> What, there isn't one? Isn't that what final does? Like this:
> final char[] charar = new char[](20);
>
> charar[1] = 'x'; // Allowed
> charar = new char[](20); // Not allowed
> charar.length = 10; // Not allowed
Final only works at the outermost level. There is no way to have a
mutable pointer to a const pointer to mutable data.
More information about the Digitalmars-d-announce
mailing list