On Tuesday, 21 January 2025 at 05:54:48 UTC, evilrat wrote:
On Monday, 20 January 2025 at 22:32:02 UTC, DLearner wrote:
It was because my understanding was that in certain situations
the string construct did not just produce a character array -
it also produced the (to me horrible) concept of adding a
x'00' immediately after the last character of the array.
This is only for compile-time known strings (aka literals) for
easy C interop, if you make strings at runtime they won't have
null terminator as a granted.
Suppose we have:
```
string str1 = "A" ~ "B";
```
Does that produce:
str1 == x'41' x'42' x'00' or
== x'41' x'00' x'42' x'00' or
== x'41' x'00' x'42' x'00' x'00'?
And is str1.length == 2 or
== 3 or
== 4?