C++ plans? (Re: r23706 - gnucash/trunk/src/register/ledger-core - Bug 721791)

John Ralls jralls at ceridwen.us
Wed Jan 22 20:57:38 EST 2014


On Jan 22, 2014, at 6:44 AM, Derek Atkins <warlord at MIT.EDU> wrote:

> John Ralls <jralls at ceridwen.us> writes:
> 
>> One other thing: I’m inclined to write any class that contributes to
>> the engine’s public API (which I intend should be much smaller than it
>> is now) to use PImpl; the pointer class will be passed as a shared_ptr
>> (i.e., reference counted like GObjects are supposed to be but mostly
>> aren’t in GnuCash) holding a unique_ptr to the private implementation
>> object. Do you have any thoughts about that?
> 
> I'm not 100% sure what "PImpl" is per-se..  But I'm fine with using
> shared_ptr<> for all object-passing/storage.  I was imaginging that we
> would use real C++ class inheritence for the core object classes
> themselves.  For example I would have implemented a QofQueriable
> interface (virtual abstract) class and had all objects inherit from
> that.

PImpl, which decomposes as either "Private Implementation" or "Pointer to Implementation" is a basic C++ idiom. Here's Herb Sutter's explanation:
http://herbsutter.com/gotw/_100/

Regards,
John Ralls




More information about the gnucash-devel mailing list