Boost logo

Boost :

Subject: Re: [boost] [fit] Mini Review (consider 1/2 or 1/4 weight)
From: Gonzalo BG (gonzalobg88_at_[hidden])
Date: 2016-03-20 08:53:49


I want to make a minor remark about this:

> [...]
>
> 1. Inline functions are weak symbols and don't violate ODR
> 2. Static variables in C++ do violate ODR (btw in C they do not) so
> basically you COPY every instance of the functions across compilation
> unit.
>
> [...]

FIT (and range-v3, and many other libraries) follow the best practice we
currently have in C++ < 17 here, which is Eric Niebler's N4381 Suggested
Design for Customization Points [0].

It seems, however, that from the discussion here and in the other reviews
of FIT, this best practice is not "common practice" yet.

The failure is only on us for not giving it enough exposure.

IMO all new Boost libraries should be following N4381 as FIT does.

On first encounter, however, a macro like BOOST_FIT_STATIC_LAMBDA
is going to look very suspicious: why is this required? what about ODR? ...

Since these macros are going to remain the only viable solution for
a long time (until we drop support for C++<17) we should address these
questions on first usage in the documentation of new libraries, maybe by
linking against N4381 directly (which addresses the issue in great detail)
or by providing a small summary of N4381 in the documentation or the
Boost wiki.

[0]
http://ericniebler.github.io/std/wg21/D4381.html#no-violations-of-the-one-definition-rule


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