Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2004-07-10 06:54:54


> When using BOOST_STATIC_CONSTANT, the member still need to be _defined_
> in a .cpp file (IIUC 9.4.2 par 4 of the standard), unless the enum-trick
> is used, right?
>
> However gcc, intel-linux and the mipspro compiler (and probably others)
> do not require a seperate definition. OTOH IBM/VisualAge does really
> _need_ the definition (otherwise the symbols are undefined when linking).
>
> Would'nt it be better to advise library-developers to use an enum
> instead of BOOST_STATIC_CONSTANT if their library does not contain a
> definition?

We've been through this before I think:

We have one compiler (IBM's) that requires an out of line definition even
when it's not required (and yes I realise it's a DR not the standard...
yet), and another (Borland) which often gives the wrong result when an enum
is used for compile time computations, and so *requires* the use of inline
static constants and not enum's. To complicate things further, compilers
are required to allow any integral constant expression to be stored in an
enum, but several (including IBM's) won't store anything wider than an int:
this also makes enum's unsuitable for use as integral constants in many
cases.

So... I guess we're just going to have to use real integral constants with
IBM and supply out of line definitions as needed?

John.


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