Boost logo

Boost :

From: Howard Hinnant (hinnant_at_[hidden])
Date: 2006-07-25 09:26:21


On Jul 25, 2006, at 8:31 AM, John Maddock wrote:

> Johan Råde wrote:
>> So it would make sense to have the functions
>>
>> is_finite()
>> is_normal()
>> is_subnormal()
>>
>> is_infinity()
>> is_plus_infinity()
>> is_minus_infinity()
>>
>> is_nan()
>
> Do we really want to use gratuitously different names from those in
> C99:
>
> isfinite
> isnorm
> isinf
> isnan

If we use the C99 names, do we intend on #undef'ing the C99 macros if
they exist (C99 says these are macros, not functions)? If we don't
then the macros will trash our functions. There's an easy technique
for converting the macro (if it exists) into a function (demonstrated
by gcc's <cmath>). If we do #undef the C99 macros, this is
observable behavior which we should document (lest the client be
testing #ifndef isnan after the boost header gets included).

I recommend restricting these templates to floating point types.
Otherwise they are overly generic, and could easily be called
accidently, especially isnormal, is_normal, isnorm (or whatever, C99
and C++0X call it isnormal).

-Howard


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk