www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2467] New: strtol() is improperly declared

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2467

           Summary: strtol() is improperly declared
           Product: D
           Version: 1.030
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: davidell earthling.net


In dmd/src/phobos/std/c/stdlib.d, the following declaration is wrong:

long   strtol(char *,char **,int);  /// ditto

it should be declared with an 32-bit "int" return value. Declared as "long",
whatever value EDX happens to have upon strtol()'s return gets stuffed into the
upper 32-bits of a 64-bit return value. My test case demonstrates this:

import std.stdio;
import std.c.stdlib;
void main(string[] args)
{
        writefln("%x", strtol("55555555", null, 16));
        assert(strtol("55555555", null, 16) == 0x55555555L);
}

The output is:
41ba3a55555555
Error: AssertError Failure a(5)


-- 
Nov 22 2008
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2467


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich gmail.com
         Resolution|                            |FIXED



22:28:54 PDT ---
Fixed long ago in core.stdc.stdlib.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 24 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2467


Vladimir Panteleev <thecybershadow gmail.com> changed:

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



04:38:51 PDT ---
Please pay attention, this is a D1 bug which is still present in D1 Phobos.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 25 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2467




05:12:48 PDT ---
Yes, sorry I've closed some bugs which are D1-only by mistake. Apologies.

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