[Issue 5231] New: BigInt lacks a normal toString()

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 17 21:03:53 PST 2010


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

           Summary: BigInt lacks a normal toString()
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: jmdavisProg at gmx.com


--- Comment #0 from Jonathan M Davis <jmdavisProg at gmx.com> 2010-11-17 21:02:36 PST ---
This program

import std.bigint;
import std.stdio;

void main()
{
    auto b = BigInt(42);
    writeln(b);
}


prints BigInt rather than 42. BigInt does not define a normal toString(). It
looks like it declares a version of toString() which takes a delegate and
format string in an attempt to have more control of what the string looks like.
However, this is useless for cases where you need an actual toString() -
particularly when functions which you have no control over call toString().
Normally, all types should define a toString() so that they can be printed, and
BigInt doesn't do that.

So, BigInt should declare a normal toString() - presumably one which prints out
the BigInt in decimal form.

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


More information about the Digitalmars-d-bugs mailing list