|
Boost : |
From: Kevin Lynch (krlynch_at_[hidden])
Date: 2001-11-07 12:03:55
Gabriel Dos Reis wrote:
>
> Kevin Lynch <krlynch_at_[hidden]> writes:
>
> [...]
>
> | While
> | there are perhaps a few isolated exceptions, it has been my experience
> | that calling one of the standard math functions with integral arguments
> | is almost always an error on the part of the programmer
>
> Well, our customers to not agree with you (their codes used to work
> before we got a C++ standard) and the reasons you're giving (which I
> understand) are not enought convincing for them
>
> -- Gaby
I understand that customers are giving people grief, but I don't yet
understand WHAT they are complaining about exactly, and why the
reasoning above doesn't convince them. I really would like to
understand what they want, though. What I'd like to do is to understand
whether what they are complaining about is what I would consider
"reasonable" usage that I'd be willing to suffer having in the standard
if it could mean getting the other stuff that I consider more important
(like the inverse hyperbolic functions). For example,
double sqrt(int)
int pow(int,int)
and similar function signatures are "reasonable"; they are not going to
"do the wrong thing" if I call
sqrt(2)
instead of
sqrt(2.)
However, I can not think of any time where it would be reasonable to
expect these types of signatures
double sin(int)
int sqrt(int)
to be in the library; they just make no sense whatsoever (there are
domain and range issues with these types of signatures).
Let me say also that there are a number of signatures that I think
really are safe and for which a reasonable argument could be made that
they are missing, including (but not limited to)
double pow(int,double)
double pow(long, double)
double pow(double, long)
(and similar overloads with float, long double, and long)
So, the question for you and Howard and anyone else whose customers have
complained about this (even though I think they are probably wrong, and
it is really their code, not the standard, that is broken :-), can you
give a reasonably complete description of the types of signatures that
they expect to see that they don't? What types of code did the
standardization "break". Unless you already have such a thing
somewhere, I'm not really asking for a detailed list of function
signatures, just a general description of the types of complaints. For
example, I can't really believe that anyone is clamoring for double
sin(int), for example, but maybe they are complaining that they "should
be able to raise an int to some power", or "take the square root of an
integer" sort of thing. And maybe there are bits of the math library
that I don't use very often that I'm not thinking of that SHOULD have
overloads that aren't there.
Additionally, if this is an instance of making customers happy by adding
signatures that I _personally_ think are wrong, but that won't actually
make the library "dangerous" for users who "know what they are doing",
I'm willing to put them into the post I plan on making, along with the
rationale for putting them in, and the reasons that they are not
"really" dangerous.
Of course, since I'm not actually on the committee, in the end, it
really won't matter what I think if people really are screaming for
double sin(int); if that's the case, I'll just have to go back to using
Fortran (blech!) :-)
-- ------------------------------------------------------------------------------- Kevin Lynch voice: (617) 353-6065 Physics Department Fax: (617) 353-6062 Boston University office: PRB-565 590 Commonwealth Ave. e-mail: krlynch_at_[hidden] Boston, MA 02215 USA http://physics.bu.edu/~krlynch -------------------------------------------------------------------------------
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk