Boost logo

Boost :

From: jsiek_at_[hidden]
Date: 1999-12-10 18:24:02


Here's a small example that breaks with VC++ 6.0 sp3.

#include <complex>

int main(int,char*[])
{
  using std::abs;
  abs(3.0);
  return 0;
}

One of the reasons for the above problem (among several I'm sure)
is that the abs() for double, etc. are not in std for VC++. Even
so it's kind of funny that the using clause hides the abs's
in the global namespace.

And you can't just tell a user to be careful because he's not the one
writing generic algorithms with abs() in, I am. (for instance, MTL has
a generic "one_norm" function using std::accumulate that will work for
all numeric types, including double and complex)

If anyone knows of any other workarounds I'd be obliged! :)

Gabriel Dos Reis writes:
> jsiek_at_[hidden] writes:
>
> | I suppose when the compilers all get up to snuff this won't
> | be a problem, but it currently is a headache.
>
> I suppose what is a headache is when a user writes "std::abs()"
> assuming std::abs() is template :-)
> We can't fix his program (and we should not try to)
>
> | ... The "using std::abs"
> | breaks under certain conditions with a compiler from
> | a town in the pacific northwest.
>
> Does 'plain' abs() also breaks?
> If so, there is nothing we can do for that user aprt from telling him
> to be careful when using abs(), sorry.
>
> -- Gaby
>
> ------------------------------------------------------------------------
> Ask your questions here http://clickhere.egroups.com/click/2030
> Everyone has unanswered questions right? So do you! Need
> free business advice, help with taxes, info on London? Our
> experts will help, for FREE!
>
>
>
> -- Easily schedule meetings and events using the group calendar!
> -- http://www.egroups.com/cal?listname=boost&m=1
>
>
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk