This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: abs function question
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: sje at cup dot hp dot com
- Cc: libstdc++ at gcc dot gnu dot org
- Date: 29 Jul 2003 06:39:30 +0200
- Subject: Re: abs function question
- Organization: Integrable Solutions
- References: <200307290013.RAA02361@hpsje.cup.hp.com>
Steve Ellcey <sje@cup.hp.com> writes:
| I am currently running into a problem with the function abs and the
| header std_cstdlib.h. This file contains the lines:
|
| namespace std
| {
| using ::abs
| }
|
| The problem is that my system's stdlib.h header file is smart enough to
| not do an extern declaration for abs if it is in C++ mode and instead
| does an inline declaration of the abs function. It only does an extern
| declaration if it is in C mode. Thus I get an error on the 'using ::abs'
| line.
Huh!? How can an inline definition could possibly clash with a using
declaration? Some piece of information is missing. Could tell us
more about that inline declaration?
| I could handle this with fixheaders but I was wondering if there
| is any reason one couldn't replace
|
| using ::abs
| with
| inline int abs(int __i) { return __i >= 0 ? __i : -__i; }
The archive should have record of past discussions on the subject. A
basic invariant is that we shall have &::abs == &std::abs.
-- Gaby