C is Brittle D is Plastic

Walter Bright newshound2 at digitalmars.com
Fri Apr 3 17:27:19 UTC 2026


I agree with everything you wrote, except:

> The worst part about D’s strings are auto-decoding

That's a Phobos-only feature, and will be dumped for the next Phobos.

> and that literals include a 
> secret zero past the end without you asking for it.

I think it's quite nice! It makes using string literals assigned to pointers (or 
implicitly converted to pointers) work seamlessly with C.

Also,

```d
pragma(msg,"hello".length);

immutable string abc = "hello";
pragma(msg, abc.length);
```
prints:

5Lu
5LU

How is it a problem?



More information about the Digitalmars-d mailing list