MSVC: fix for failing tests due to strtod+hexadecimal literals
Johan Engelen via digitalmars-d-ldc
digitalmars-d-ldc at puremagic.com
Sun Mar 1 13:00:52 PST 2015
Hi all,
MSVC's strtod does not deal correctly with hexadecimal floating
point literals, resulting a few unittests failing. For example,
the following program
import std.math, std.stdio;
void main() {
writeln(PI);
}
outputs "0" (zero), simply because std.math.PI is defined using a
hex literal and LDC2 compiled with MSVC cannot deal with that.
See: https://github.com/ldc-developers/ldc/issues/761
I added
#if _MSC_VER <= 1800
VersionCondition::addPredefinedGlobalIdent("MSVC_STRTOD_NOHEXREALS");
#endif
to main.cpp, and then in std.math I defined PI and friends using
decimal floating point literals for
version(MSVC_STRTOD_NOHEXREALS).
Is this a desired fix? (i.e. trying to make a better build with
MSVC while we wait for the new version)
One positive effect of this change is that it un-hides some other
failing tests.
thanks for comments,
Johan
More information about the digitalmars-d-ldc
mailing list