Boost logo

Boost :

Subject: Re: [boost] Rave for proposed Boost.Local (functions)
From: Jeffrey Lee Hellrung, Jr. (jhellrung_at_[hidden])
Date: 2011-02-06 23:09:15

On 2/6/2011 5:46 PM, Lorenzo Caminiti wrote:
> On Sun, Feb 6, 2011 at 3:23 PM, Jeffrey Lee Hellrung, Jr.
> <jhellrung_at_[hidden]> wrote:
>> On 2/6/2011 9:17 AM, Lorenzo Caminiti wrote:
>> [...]
>>> I am posting here the code generated by the macros which might help
>>> curious readers in spotting costly operations performed by Boost.Local
>>> (if there are any). This of course does not include the preprocessing
>>> time. (I hope it's not too much code... just try to get passed the
>>> typeof noise at the beginning...)
>> Is the use of Boost.Typeof optional? I.e., can I just provide the types of
>> the arguments and bound variables myself?
> No but I think you can simply use a normal (not bound) local function
> parameters to do this:

So Boost.Typeof is necessary to bind variables...?

>>> boost::scope_exit::aux::declared< boost::scope_exit::aux::resolve<
>>> sizeof(boost_local_auxXargs)>::cmp1<0>::cmp2>
>>> boost_local_auxXargs;
>> Shouldn't the name boost_local_auxXargs have some kind of line number or
>> counter or function name pasted into it to prevent name collision of
>> multiple BOOST_LOCAL_FUNCTION declarations in the same scope?
> No, this has to be a global extern variable declared as:
> extern boost::scope_exit::aux::undeclared boost_local_auxXargs;
> in one of Boost.Local headers. It's a trick carried over 100% from
> Boost.ScopeExit (as I understand it, this is because only global or
> static variables can be used from within a nested block

Ugh, okay ;) Will read the link.

>> For maintenance purposes, do you plan on providing a brief sketch of the
>> above mechanism (e.g., the main players in the above macro expansion, and
>> the inheritance from function_base and type-erasure to simulate the binding
>> of local functions to template parameters)?
> Yes, I can add an Appendix with the pseudo code in the library docs.


>> I remember you doing an earlier study on the performance impact of using
>> this type erasure (compared to moving the local function to namespace scope
>> and avoid the overhead of the virtual dispatch) that included in the
>> documentation? I don't see it from a quick glance...
> A preliminary study was hinted by John Bytheway
> ( I have not
> done any performance study of Boost.Local yet (yes, I will include
> performance considerations in the docs once I do them).

This must be what I remembered.

- Jeff

Boost list run by bdawes at, gregod at, cpdaniel at, john at