|
Boost : |
Subject: [boost] C++11 compilers and fenv
From: Damian Vicino (damian.vicino_at_[hidden])
Date: 2015-05-05 22:25:21
Hi,
Iâm implementing the safe_float library (on c++11) proposed for the GSOC .
I was planning to access FENV for detecting unsafe operations on the native floating point types and include some custom pre-post conditions for testing other floating types safety conditions.
Conditions come from policies passed as template parameter to give users the possibility of chose their own set of safety conditions to be enforced.
An example of the conditions that can be asked is enforcing overflows to infinite does not happen.
An overflow to infinite can be detected by the FE overflow flag or because the addition of two finites numbers result in an infinite one.
I just found today that clang++ does not support the pragma to use FENV yet.
warning: pragma STDC FENV_ACCESS ON is not supported
Googling a little I found out that neither does gcc.
How are c++11 boost libraries dealing with these compiler issues?
I got some options in mind:
â Implement everything using custom detections, this will work in every compiler, but it will run slower for everyone too.
â Finding a compiler with the support, implementing the library using the FENV, and assuming compilers will support it when the library is finished and reviewed.
â Detect somehow the FENV pragma was not processed and have 2 implementations. No idea how to detect something like this.
Had someone dealt with similar problem already?
Is there a common approach?
Best regards,
Damian Vicino
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk