C is Brittle D is Plastic
Nick Treleaven
nick at geany.org
Wed Apr 29 13:26:40 UTC 2026
On Monday, 27 April 2026 at 12:24:59 UTC, Quirin Schroll wrote:
> If you call such a function with a `""` literal, it would
> become NUL-terminated because of that reason. I definitely
> mentioned this exception. Essentially, a `""` string passed to
> a `const(char)*` directly would be as if you wrote a `""z`
> string.
Very likely existing working code does something like:
```d
void f(const char*);
const s = "hi";
f(s.ptr); // boom
```
More information about the Digitalmars-d
mailing list