-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move numeric_limits<half> specializations into half.h #241
Conversation
Previously, these specializations have been in the header halfLimit.h, but without this header, the numeric_limits<> template provides default specializations that return 0, so, for example, std::numeric_limits<half>::min() would silently return 0 in code that inadvertently omitted the #include <halfLimits.h>. The numeric_limits specializations should be considered an inseparable part of the class definition. This change moves the specializations directly into half.h and deprecates the halfLimits.h header altogether. For backwards compatibility, it includes half.h with a warning. An alternative would be to keep halfLimits.h and include it in half.h, but then each header would include the other circularly, which is awkward. Signed-off-by: Cary Phillips <cary@ilm.com>
As far as I'm concerned, the closer we get to the entire universe of |
…eFoundation#241) Previously, these specializations have been in the header halfLimit.h, but without this header, the numeric_limits<> template provides default specializations that return 0, so, for example, std::numeric_limits<half>::min() would silently return 0 in code that inadvertently omitted the #include <halfLimits.h>. The numeric_limits specializations should be considered an inseparable part of the class definition. This change moves the specializations directly into half.h and deprecates the halfLimits.h header altogether. For backwards compatibility, it includes half.h with a warning. An alternative would be to keep halfLimits.h and include it in half.h, but then each header would include the other circularly, which is awkward. Signed-off-by: Cary Phillips <cary@ilm.com>
Previously, these specializations have been in the header halfLimit.h, but without this header, the numeric_limits<> template provides default specializations that return 0, so, for example, std::numeric_limits<half>::min() would silently return 0 in code that inadvertently omitted the #include <halfLimits.h>. The numeric_limits specializations should be considered an inseparable part of the class definition. This change moves the specializations directly into half.h and deprecates the halfLimits.h header altogether. For backwards compatibility, it includes half.h with a warning. An alternative would be to keep halfLimits.h and include it in half.h, but then each header would include the other circularly, which is awkward. Signed-off-by: Cary Phillips <cary@ilm.com>
I slightly disagree with the deprecation warning. Some projects may see the warning and think "oh, we will just remove the include / replace the include with |
Previously, these specializations have been in the header
halfLimit.h
,but without this header, the
numeric_limits<>
template providesdefault specializations that return 0, so, for example,
std::numeric_limits<half>::min()
would silently return 0 in code thatinadvertently omitted the
#include <halfLimits.h>
.The
numeric_limits
specializations should be considered an inseparablepart of the class definition.
This change moves the specializations directly into half.h and
deprecates the
halfLimits.h
header altogether. For backwardscompatibility, it includes
half.h
with a warning.An alternative would be to keep
halfLimits.h
and include it inhalf.h
,but then each header would include the other circularly, which is
awkward.
Should address #240.
Signed-off-by: Cary Phillips cary@ilm.com