|
Boost : |
From: Gary Powell (Gary.Powell_at_[hidden])
Date: 2000-11-29 17:40:03
> As a minor syntax issue, I would like to suggest static member
> functions instead of global ones, for example
>
> template<class T>
> class rational {
> public:
> static rational exact_from_double(double x);
> // ...
> };
>
I would prefer that "float" and "double" occur nowhere in the code for
rational.hpp
Reasoning: is that not too long ago I had to write code for a CPU that did
not have a floating point processor. Linking in the floating point
simulation library was expensive, slow, increased my executable size and not
allowed in the released product.
As C++ is still used in embedded systems, some of which may still use this
processor, I suggest that if there is an alternative which allows
independent linking choose it. i.e. Ship the conversion algorithm in a
separate file. Users who don't require the conversion won't get it. Should a
future algorithm for conversion prove better for a particular application,
the programmer would be able to change it with greater ease. It would also
emphasize what algorithm was chosen, and that in fact it is replaceable.
Yours,
-gary-
gary.powell_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk