Thread overview
[Issue 607] New: toString can't handle char[]
Nov 27, 2006
d-bugmail
Nov 27, 2006
d-bugmail
Dec 12, 2006
d-bugmail
November 27, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=607

           Summary: toString can't handle char[]
           Product: D
           Version: 0.175
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: davidl@126.com


in phobos toString only play with char*
remember char* is different from char[]
i use enki to parse a char[] buf, and set the substrings in buf to be the AA's
keys and values, then i tostring AA["Key1"] , i can see not only the AA["key1"]
given , but also something in buf all tostringed
a simple case couldn't be provided by now, but i think std.string should
include a new func
char[] toString(char[] s)
{
         return s;
}


-- 

November 27, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=607


davidl@126.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|toString can't handle char[]|toString can't handle char[]




------- Comment #1 from davidl@126.com  2006-11-27 09:01 -------
The problem is actually the compiler can implicitly cast char[] to char*
then the toString take char[] in without any warnings or error message shown.
but it is dangerous to pass char[] to toString
maybe we don't neet the implicitly cast from char[] to char*

or we need to provide either of the funcs as the following:
char[] toString(char[]s)
{
    static assert(`Error use of toString, u can't toString a String`);
}

or

char[] toString(char[]s)
{
    return
}


-- 

December 12, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=607


bugzilla@digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #2 from bugzilla@digitalmars.com  2006-12-12 04:15 -------
Fixed DMD 0.176


--