Boost logo

Boost :

Subject: Re: [boost] [system][chrono] header-only libs
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2011-01-03 02:05:41


----- Original Message -----
From: "Beman Dawes" <bdawes_at_[hidden]>
To: "boost" <boost_at_[hidden]>
Sent: Monday, January 03, 2011 2:56 AM
Subject: Re: [boost] [system][chrono] header-only libs

> On Sun, Jan 2, 2011 at 12:24 PM, vicente.botet <vicente.botet_at_[hidden]> wrote:
>> Beman,
>>
>> I would like to know if you are yet interesteed on the header only version for Boost.System.
>>
>> Best,
>> Vicente
>
> I'm interested in the concept, but we would need to do a lot better
> that the code in the sandbox:
>
> Much of boost/system/detail/inlined/error_code.hpp code duplicates
> libs/system/src/error_code.cpp code. That isn't acceptable since it
> would create a maintenance nightmare. Code for each component needs to
> be defined in a single file, with macro magic to abstract away the
> difference between the library. Having to do every maintenance fix in
> two places isn't practical - the code will certainly diverge over
> time.

Hi,

Beman you have maybe missed the conditional compilation

#if 1
#define BOOST_SYSTEM_SOURCE
#include <boost/system/detail/inlined/error_code.hpp>
#else
// old code
#endif

I used this artifice to make easier possible evolutions of these file on trunk. So at the end the else part will be removed and there will be no duplicated code.
 
> The test framework also needs more work. Testing only the inlined
> version doesn't give enough confidence the library version works OK.

I've adapted the Boost.Chrono Jamfile to tests all the configurations

* shared link
* static link
* header only with BOOST_CHRONO_INLINED and BOOST_SYSTEM_INLINED
* header only with BOOST_USE_WINDOWS_H

as follows:

rule chrono-run ( sources )
{
    return
    [ run $(sources) ../build//boost_chrono
        : :
        : <define>BOOST_USE_WINDOWS_H
            <library>/boost/system//boost_system
        : $(sources[1]:B)_shared ]
    [ run $(sources) ../build//boost_chrono/<link>static
        : :
        : <library>/boost/system//boost_system
        : $(sources[1]:B)_static ]
    [ run $(sources)
        : :
        : <define>BOOST_CHRONO_INLINED
            <define>BOOST_SYSTEM_INLINED
        : $(sources[1]:B)_header ]
    [ run $(sources)
        : :
        : <define>BOOST_CHRONO_INLINED
           <define>BOOST_USE_WINDOWS_H
           <define>BOOST_SYSTEM_INLINED
        : $(sources[1]:B)_header_win ]
    ;
}

Then we use it like

        [ chrono-run duration/arithmetic_pass.cpp ]

I can add a similar kind of rule on Boost.System test so all the configurations are tested.

Best,
Vicente


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