Boost logo

Boost :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-07-11 14:50:27


AMDG

David Abrahams wrote:
> I fully agree. My point was that he's got a problem that we're not
> solving by simply insisting on ODR-friendly practices.
>
>
>> The only safe way to allow replacement of a library function that I
>> know of is to use a macro, since this can be set globally.
>>
>
> Many people think macros are too ODR-prone also.
>

What other ways are there to solve it? I realize that macros are still
dangerous but they are better than any alternative that I know--other
than only allowing customization through specializations that involve
at least one user defined type.

Is there any known way of automatically triggering a link error if macros
are defined differently in different translation units? I can think of
a manual
way:

a.cpp:

void BOOST_PP_CAT(a_cpp_compatibility, OPTIONS_ENCODED_AS_IDENTIFIER)() {}

b.cpp

static void test_a_cpp_compatibility() {
    BOOST_PP_CAT(a_cpp_compatibility, OPTIONS_ENCODED_AS_IDENTIFIER)();
}

In Christ,
Steven Watanabe


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