Where is C++'s math.h's double abs(double)?
Steven King
sxking@uswest.net
Mon Apr 2 17:01:00 GMT 2001
On Monday 02 April 2001 3:17, Gabriel Dos Reis wrote:
> There is no
>
> double abs(double)
>
> declared in <math.h> -- the double version in <math.h> is named "fabs".
>
> However
>
> double std::abs(double)
>
> is declared in <cmath>
Ah, but as I'm sure you know, according to Annex D (depreciated features) of
the standard:
" Each C header, whose name has the form name.h, behaves as if each name
placed in the Standard library namespace by the corresponding cname header is
also placed within the namespace scope of the name-space std and is followed
by an explicit using-declaration (7.3.3) 3
[Example: The header <cstdlib> provides its declarations and definitions
within the namespace std. The header <stdlib.h> makes these available in the
global name space, much as in the C Standard. end example]"
thus <math.h> should make available in the global namespace all of the
defintions in cmath. The default configuration doesnt do this; instead one
must specify "--enable-cheaders=c_shadow"; however that may not bootstrap (it
doesnt on linux-x86).
More information about the Libstdc++
mailing list