www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17180] New: to!string('\0') makes "\0" which breaks

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

          Issue ID: 17180
           Summary: to!string('\0') makes "\0" which breaks concatination
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: jiki red.email.ne.jp

import std.conv;
import std.stdio;

void main() {
  char c = 0;
  string s = to!string(c);

  writeln(`"` ~ s ~ `"` ); stdout.flush(); // the last quate GONE
  assert(s.length == 0 || s[0] != '\0');
}


# We want one of these, at least.

* Empty string
* Alternative character or message
* Raising an error

--
Feb 13