This is the mail archive of the mailing list for the elfutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/2] Add C++ iterators

Mark Wielaard <> writes:

> I like this because it makes things easy and clear on the ABI side.
> I am not so concerned about the PLT call, but the new allocation and
> delete in the destructor is indeed a little heavy-weight since I assume
> iterators are often short lived so it will cause lots of small
> new/deletes. I guess we just will have to live with that if we want ABI
> stability. Do others also think this is a acceptable tradeoff?

One thing just occured to me.  We could represent end iterator as an
iterator without associated pimpl.  That way, the typical C++ idiom:

for (elfutils::some_iterator it (dw);
     it != elfutils::some_iterator::end (); ++it)

... wouldn't end up being horribly terribly expensive.

>> Symbols are versioned.  This ties us closely to the GCC ABI, but I think
>> everybody uses Itanium ABI these days anyway.  This also means that if
>> there should be a change in behavior that would constitute an ABI
>> breakage, it can be mitigated the same way as with C symbols.
>> I hid many symbols as well.  Namely the private constructors are not
>> exported at all, and I have also hidden the not-in-charge constructor
>> and destructor variants, because those should only come into play when
>> the iterators are inherited from, which they are not designed for.
> I am happy we have an explicit ABI now. But I am somewhat concerned
> about how libdw/ looks. Is this really the best we can do? It
> feels somewhat unmaintainable if we have to hand edit this version
> script. How did you generate this?

Cut'n'paste from symbol tables.

One alternative way would be to use version namespace instead.  Using
version script may have been too much of cargo culting for C++


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]