Boost logo

Boost :

From: Paul A Bristow (boost_at_[hidden])
Date: 2003-06-08 09:56:53


| Genny wrote
 
| Paul> What I would like to get is agreement on the presentation
| of constants.
|
| You mean macros vs. constant variables vs. inline functions?
| This is another thing I didn't understand by looking at the
| documentation: the FAQ section seems sometimes to imply you
| have already done a choice in this regard;

In the previous review, Boosters suggested strongly different views on
different ways of presenting constants. As I have tried to explain,
there are pros and cons and valid reasons for wanting all of these.

 for instance:
|
| Q. Why not use floating-point hardware constants?
| A. Because only a few are available, they are often not the right
| size, are not available on all processors, and most important
| are sometimes not accurate enough.
|
| but then, in another point:
|
| Q. Why are functions like double pi() which return constants
| provided?
| A. It provides a framework whereby users can plug in special
| implementation and hardware-specific versions.

Indeed - so the _user_ needs to be able to make the choice,
and this implies that a single representation of constants won't do.

| "Because some compilers may be able to produce smaller
| and/or faster code.(For example, note that MSVC 7 Standard
| edition only inlines "__inline", so this will produce slower
| and longer code)."
|
| Maybe you meant: "because some compilers generate better
| code with a manifest constant and others better code with a
| function"?

You could also say that - I'm open to suggestions.

Paul


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