Boost logo

Boost :

From: Alexander Nasonov (alnsn-mycop_at_[hidden])
Date: 2003-09-25 08:25:46


David Abrahams wrote:

> Alexander Nasonov <alnsn-mycop_at_[hidden]> writes:
>> I still hope that static_list<char const*>::begin is enough. I should
>> check where inline functions are defined, though.
>
> Well, that is just an _astounding_ reading of the standard. I too
> would love it to be enough. I am going to check it out with the CWG,
> though.

I'm waiting for positive answer ;)

> In the meantime, have you checked whether implementations actually
> support this?

Not yet. Someone should check all these *.o, *.a and *.so (*.obj, *.lib and
*.dll under Windows).

> It would seem to incur a serious penalty for inline
> functions at link time.

... in case this library is used in many translation units.

Today I added more to the code to make sure that begin/end/size are defined
in every translation unit where insertion takes place. For details, search
for force_definition here:

http://cpp-experiment.sourceforge.net/static_list/static_list.hpp

When a user calls begin function first time this should force initialization
of all objects of namespace scope defined in translation unit where begin
is defined. There is only one definition in case of non-inline functions
(ODR). In opposite, "An inline function shall be defined in every
translation unit in which it is used" (3.2/3). Last version od
static_list.hpp uses all public functions inside struct insert.

These all looks very strange and curious.
Although inline functions may have been defined in different object files,
linker throws all but one away. Which one survives in unspecified.

-- 
Alexander Nasonov
Remove minus and all between minus and at from my e-mail for timely response

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