Boost logo

Boost :

Subject: Re: [boost] D-style scope guards?
From: Martin Christiansson (martin.christiansson_at_[hidden])
Date: 2010-09-19 15:03:23


>> boost::bind is used when calling the function with it arguments.
>
> Now this is a show-stopper for me, because bind creates a function object

Not actually needed. Went through that in an earlier reply.

>
> I'd still challenge the advantage of any such solution over writing wrappers:
>

That would be an option if there where a few functions that needed
wrappers or at least that they rarely change their argument list. That
is not the case for me. Reducing the number of lines of code to write
is important.

>
>> } catch (std::exception& e) {
>>     cout << (&e)->what() << endl;
>              ^^^^^^
> what()? =D
>

What can I say... I like pointers. No, seriously... Feel free to
replace with e.what().

>> Still need some code cleanup, but I think it will be quicker to translate
>> from C-style return values to a "legacy exception" than writing the code
>> manually for each function call.
>
> But that's what you are doing! You _are_ repeating the error checking code for
> every call, only that you use a different syntax.
>

The main issue is to reduce the amount of code to write and maintain
since the number of functions is considerable and a moving target. A
change in the C-API:s will only require a change to the line where
it's called. A wrapper would add an additional part of code to write
and maintain. Added cost that is hard to justify to the one who's
paying the bill. Added time to a project is even worse.

/Martin


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