On 31/05/16 06:44, Albert Astals Cid wrote: > El dilluns, 30 de maig de 2016, a les 15:53:51 CEST, Carlos Garcia Campos va > escriure: >> Jakub Kucharski <[email protected]> writes: >>> On Sun, 2016-05-29 at 22:50 +0200, Albert Astals Cid wrote: >>>> Hi guys, what do you think of us adding "some" of the C++11 features >>>> in >>>> poppler? >>>> >>>> One that would be useful for example is std::unique_ptr, that is a >>>> class that >>>> will take ownership of a pointer and delete it when it goes out of >>>> scope. >>> >>> I think *some* C++11 features (e.g. std::unique_ptr) would make things >>> easier. However there are some which could make things harder, e.g. >>> type inference (auto) - it sometimes makes it hard to reason about the >>> code when you don't know what type a function returns. So yes, some >>> C++11 features would be OK, but perhaps we could make guidelines for >>> it. >> >> Well, we could just document the cases where it could be used. > > Do we want to make that list now or go over it on a patch-by-patch, case-by- > case basis?
I would decide which C++11 features to use on a patch-by-patch basis. It is easier to see if a particular feature is adding value in the context of a patch. > > Cheers, > Albert > >> We don't >> use templates in poppler, so we don't have huge types where auto is >> quite useful, but still there are cases where things look much better, >> like in modern for loops: >> >> for (auto foo : fooList) >> >> also in cases where the type is twice like: >> >> Foo* f = reinterpret_cast<Foo*>(b); -> auto f = reinterpret_cast<Foo*>(b); >> or >> Foo* f = std::make_unique<Foo>(); -> auto f = std::make_unique<Foo>(); >> >>> Jakub >>> >>> _______________________________________________ >>> poppler mailing list >>> [email protected] >>> https://lists.freedesktop.org/mailman/listinfo/poppler > > > _______________________________________________ > poppler mailing list > [email protected] > https://lists.freedesktop.org/mailman/listinfo/poppler > _______________________________________________ poppler mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/poppler
