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

Jules Bergmann jules at codesourcery.com
Fri Nov 11 14:58:56 UTC 2005



Stefan Seefeld wrote:
> 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.

My initial reaction is that we shouldn't put stuff into std namespace 
because it may break some application's expectations.  Of course, such 
apps are in trouble, since a change in cmath/cstdlib include order would 
break their assumptions.

If we do go with 'namespace std { using ::abs; }', we should still have 
a configure check and only much with std:: when necessary.

				-- Jules



More information about the vsipl++ mailing list