[vsipl++] [patch] RFA mercury's missing std::abs

Stefan Seefeld stefan at codesourcery.com
Fri Nov 11 14:07:29 UTC 2005


Jules Bergmann wrote:
> This patch checks for missing std::abs overloads for float and double at 
> configure time.  If missing (and ::abs overloads exist), 
> VSIP_IMPL_FIX_MISSING_ABS is defined, which causes vsip::mag and 
> vsip::magsq to use a blend of vsip::abs and ::abs.
> 
> This should be more robust than relying on the order of <cmath> and 
> <cstdlib> (which might break if users include standard headers before 
> including vsip headers -- something I tend to do).
> 
> Comments?

Since we now understand exactly what is going wrong (i.e. the

namespace std { using ::abs;}

line is issued before the relevant declarations have been seen),
why don't we simply place such a using-directive close to our own
inclusion of <cmath> ? That would have the exact same effect as
including <cstdlib> after <cmath>, without relying on its header guards
not being active.

Regards,
		Stefan



More information about the vsipl++ mailing list