Thread overview
[Issue 6157] New: to!string should work for various pointer types
Jun 14, 2011
Andrej Mitrovic
Jan 05, 2012
Andrej Mitrovic
Jan 05, 2012
Andrej Mitrovic
Oct 06, 2012
Andrej Mitrovic
Oct 06, 2012
Andrej Mitrovic
Jan 13, 2013
Andrej Mitrovic
June 14, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6157

           Summary: to!string should work for various pointer types
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: andrej.mitrovich@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2011-06-14 15:34:46 PDT ---
import std.conv;

void main()
{
    char*  cstr = "bla".dup.ptr;
    wchar* wstr = "bla"w.dup.ptr;
    dchar* dstr = "bla"d.dup.ptr;

    to!string(cstr);    // ok
    to!string(wstr);    // fail
    to!string(dstr);    // fail
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 05, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6157



--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-01-04 16:59:06 PST ---
Created an attachment (id=1067)
utf

Added implementation to be added to std.conv. These have to be further verified.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 05, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6157



--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-01-04 17:00:31 PST ---
Btw, several people have asked for to!(char*)/to!(wchar*)/to!(dchar*) to work,
so I've added a simple template overload that forwards to toUTFz. Personally I
think this is a good convenience.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 06, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6157


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |major


--- Comment #3 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-10-06 14:45:55 PDT ---
Whoa, this has now turned from CT failure to outputting garbage. I'm raising importance of this:

import std.stdio;
import std.conv;

void main()
{
    char*  cstr = "bla".dup.ptr;
    wchar* wstr = "bla"w.dup.ptr;
    dchar* dstr = "bla"d.dup.ptr;

    writeln( to!string(cstr) );  bla
    writeln( to!string(wstr) );  // 972F90
    writeln( to!string(dstr) );  // 972F80
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 06, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6157



--- Comment #4 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-10-06 14:46:50 PDT ---
(In reply to comment #3)
> Whoa, this has now turned from CT failure to outputting garbage.
Technically not garbage but the pointed value is interpreted as an integer.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 13, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=6157


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

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


--- Comment #5 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-01-13 10:34:43 PST ---
*** This issue has been marked as a duplicate of issue 8384 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------