[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Conflicting round() declaration only with g++-3.0



Mikael Hedin wrote:

def.H: In function `int round(double)':
def.H:211: new declaration `int round(double)'
/usr/include/bits/mathcalls.h:287: ambiguates old declaration `double round(double)'
make: *** [lisp.o] Error 1

The declarations are from the tela source

inline int round(Treal x) {return (x < 0) ? (int)(x-0.5) : (int)(0.5+x);}

and from libc

/* Round X to nearest integral value, rounding halfway cases away from
   zero.  */
__MATHCALL (round,, (_Mdouble_ __x));

Actually I don't see the problem with these declarations.  Can ayone
help?

g++ is telling you exactly what is wrong with them.  They are
ambiguous because they take the same type of arguments.

I use g++-3.0 version 3.0-0pre010427 and g++-2.95 version
2.95.4-0.010506.

Note that 3.0 is far more strict about these sorts of things,
const-ness, exception specifications and so on.  It really
sometimes does take a significant amount of work to fix up
existing code.

Namespaces would be a good place to start.  :)

-Dave

--

"Some little people have music in them, but Fats, he was all music,
and you know how big he was."  --  James P. Johnson



Reply to: