[poppler] Some C++11 in poppler?

Albert Astals Cid aacid at kde.org
Tue May 31 23:18:32 UTC 2016


El dimarts, 31 de maig de 2016, a les 22:57:43 CEST, Adrian Johnson va 
escriure:
> 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 <jakubkucharski97 at gmail.com> 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.

+1

> 
> > 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
> >>> poppler at lists.freedesktop.org
> >>> https://lists.freedesktop.org/mailman/listinfo/poppler
> > 
> > _______________________________________________
> > poppler mailing list
> > poppler at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/poppler
> 
> _______________________________________________
> poppler mailing list
> poppler at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/poppler




More information about the poppler mailing list