www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8424] New: Compile time conversions of double/floats to strings


           Summary: Compile time conversions of double/floats to strings
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: mail basgeertsema.net

--- Comment #0 from Bassieg <mail basgeertsema.net> 2012-07-24 03:22:23 PDT ---
When converting a float to a string from within a mixin an error is given. 


import std.conv;
enum doubleString = mixin("to!string(0.6)");

Gives the following error:

..src\phobos\std\format.d(1355): Error: _snprintf cannot be interpreted at
compile time, because it has no available source code

The reason for the error is clear: _snprintf is an external function and can
therefore not be interpreted.

However, I think that compile-time conversion of floats to strings should be
supported. Perhaps the formatting code can be ported to the std library instead
of using an external function?

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