Where are std::sinf( float ) etc.

Howard Hinnant hhinnant@apple.com
Thu Dec 29 23:10:00 GMT 2005


On Dec 29, 2005, at 4:50 PM, Gabriel Dos Reis wrote:

> Howard Hinnant <hhinnant@apple.com> writes:
>
> | On Dec 29, 2005, at 4:07 PM, Gabriel Dos Reis wrote:
> |
> | > Howard Hinnant <hhinnant@apple.com> writes:
> | >
> | > [...]
> | >
> | > | > As to overloads for std::cosf (note the suffix), I find the
> | > | > justificaton for them as "C99 compatibility" as dubious.
> | > |
> | > | Interesting.
> | >
> | > cos() is "overloaded" in C99 through <tgmath.h>; not cosf.  If the
> | > motivation for a C++ library to add overloads for cosf is
> | > compatibility then the motivation better finds a different, more
> | > convincing, excuse.
> | >
> | > -- Gaby
> |
> | My mistake again.  I thought Ed was simply asking for:
> |
> |   float std::cosf( float );
> |
> | which is required by C99.
>
> No C++ standard requires that signature (for C99 compatibility.)
>
> What libstdc++ does is to try to mess minimally with your "C" headers
> <xxx.h>, so that if you include <math.h> chances are that your cosf 
> () will
> just work fine.  There is no std::cosf() because no such thing is
> mandated.
> If I remember correctly (and my memory may be failing here), there is
> a proposal to acknowledge that implementations could have <cxxx>  put
> everything in both global and std:: scope.
>
> When the C99 compat problem was urgent, we tried several variations,
> and at some point we put them in __gnu_cxx.  The c_shawdow was an
> effort to implement the standard letter, it never succeeded, partly
> because for implementations like GCC, it was an unrealistic
> requirement.
>
> |  Having that signature (not any overloads
> | of it) in the name of "C99 compatibility" does not seem dubious to
> | me.
>
> Well, given that C99 does not have std::, the compatibility claim  
> needs
> more explanation.  If compability is a real issue, then the standard
> should require that "C" headers are left *alone*, untouched.  But the
> standard did something else, causing more troubles, and now we need
> more kludge in the name of compatibility?
>
> | I'm not sure where we started discussing overloading cosf, nor
> | with what signature.
>
> -- Gaby

I just *knew* my careless copy/paste error was going to cost me  
dearly. :-(

float cosf(float);

which is required by C99.  Having that signature (not any overloads  
of it) in the name of "C99 compatibility" does not seem dubious to  
me.  I'm not sure where we started discussing overloading cosf, nor  
with what signature.

-Howard



More information about the Libstdc++ mailing list