Boost logo

Boost :

From: Ed Brey (brey_at_[hidden])
Date: 2001-05-18 07:51:40


From: "Paul A. Bristow" <pbristow_at_[hidden]>

> I think people will expect to find names for pi/2 and 2*pi,
> and the programs will read more nicely if these are present.
> Of course a rational naming scheme is essential, as we have agreed.

My expectation is that code will be easiest to read if we avoid factors.
For one, I think seeing the math directly is more straightforward, as
in:
    pi / 2 and 2 * pi
vs
    half_pi and two_pi

The issue becomes more accute when the user needs constants that the
library doesn't provide. He might end up with inconsistent code like
this:
    half_pi * sqrt( a * (pi / 5) )

If it were really all that notationally convenient to have
specially-named common factors of fundamental constants, I think you
would have seen the mathematics world a long time ago come up with
special symbols for 2 * pi, etc.

> Does anyone know what the costs are?
> Does it matter if we add a hundred names?
> Does it cause code bloat?
> Does it case linker constipation?

Under VC6, inline functions and namespace-level constants cost nothing
if you don't use them: they never even make it to the object file.
Static class members make it to the object file, but get stripped out by
the linker if they are unused.


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