www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21034] New: concatenation with a string literal could also

https://issues.dlang.org/show_bug.cgi?id=21034

          Issue ID: 21034
           Summary: concatenation with a string literal could also append
                    the trailing null
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: b2.temp gmx.com

This currently fails:

---
void main()
{
    string s = "0123";
    auto c = &s[2];
    s =  "0";
    s = s ~ "1";
    assert(*c == '\0');
}
---

this would be a enhacement to support this. Example: add an extension and pass
the .ptr property directly to a C style API, without having to call toUTFz /
toStringz

--
Jul 10 2020