[Issue 8143] Safe std.conv.to enum conversion
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Oct 23 16:44:29 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8143
Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |andrej.mitrovich at gmail.com
--- Comment #1 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-10-23 16:44:27 PDT ---
One problem with this is:
enum EF : float { C = 4.9 }
float f = 4.9;
EF en2 = to!EF(f);
This will fail internally if conv.to compares members via "==", because of
floating point comparison semantics.
So the question is, is this going to be a problem? If yes, should we use
approxEqual for floating point comparisons? Or maybe we should simply ban using
std.conv on enums that have a floating point base type?
--
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