Boost logo

Boost :

From: Gabriel Dos Reis (Gabriel.Dos-Reis_at_[hidden])
Date: 2001-11-07 07:40:34

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, and in C at
| least, it is the type of error that can be very very difficult to track
| down, because the compiler doesn't have to tell you that you "might" be
| doing something wrong. I can't think of any case where something like
| int i = 1;
| double d = sin(i);
| would be anything but an error in coding, and if you are doing it with a
| literal, it doesn't take any real additional effort to write
| sin(1.); than to write sin(1);
| (OK, I'll grant that something like double d = sqrt(2); is occassionally
| useful, and certainly true that pow(int,int) can be very useful for
| smaller arguments at times, but it isn't that much harder to write
| double d = sqrt(2.); or even
| int i;
| // intervening code which sets i ...
| double d = sqrt(static_cast<double>(i));

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

Boost list run by bdawes at, gregod at, cpdaniel at, john at