#4012 -Dstrtod doesn't do what is expected.

obsolete: 8.5.2

The use of -Dstrtod=fixstrtod is not reliable. When glibc's headers are read, the inline definition of strtod in terms of __internal_strtod is modified by the macro. So, while every call to strtod() is replaced with a call to fixstrtod(), that refers to an inline function, and the library's standard __internal_strtod() is called anyway. If the configure script's test to determine that it needs to modify strtod is correct, it is having no effect in the default configuration of glibc.

In general, C does not really "allow" redefinitions of standard library functions. Obviously, there is a compelling reason to try to outsmart the library in this case.

The correct way to do this is to, *AFTER* including the standard headers, execute code something like this:

extern double fixstrtod(const char *, char **);
#undef strtod
#define strtod fixstrtod

This is still probably undefined behavior, but I'm pretty confident that it will work.


  • Don Porter

    Don Porter - 2008-05-28
    • milestone: --> obsolete: 8.5.2
    • assigned_to: nobody --> dgp
    • status: open --> pending-out-of-date
  • Don Porter

    Don Porter - 2008-05-28

    Logged In: YES
    Originator: NO

    The strtod() call no longer appears
    in any part of the Tcl source code,
    so whatever valid flaws are reported
    here no longer matter.

  • SourceForge Robot

    • status: pending-out-of-date --> closed-out-of-date
  • SourceForge Robot

    Logged In: YES
    Originator: NO

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks