www.digitalmars.com         C & C++   DMDScript  

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

http://d.puremagic.com/issues/show_bug.cgi?id=8424

           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



When converting a float to a string from within a mixin an error is given. 

Example:

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