This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Where is C++'s math.h's double abs(double)?
- To: "Gabriel Dos Reis" <Gabriel dot Dos-Reis at cmla dot ens-cachan dot fr>,"Jeffrey Oldham" <oldham at codesourcery dot com>
- Subject: Re: Where is C++'s math.h's double abs(double)?
- From: Steven King <sxking at uswest dot net>
- Date: Mon, 2 Apr 2001 15:53:58 -0800
- Cc: libstdc++ at gcc dot gnu dot org
- References: <20010402141647.A11992@codesourcery.com> <flpuevdk01.fsf@sel.cmla.ens-cachan.fr>
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).