[fpc-pascal] Generics vs templates

Sven Barth pascaldragon at googlemail.com
Mon Jan 8 15:00:41 CET 2018

Am 08.01.2018 12:52 schrieb "Ryan Joseph" <ryan at thealchemistguild.com>:

> On Jan 8, 2018, at 5:58 PM, Sven Barth via fpc-pascal <
fpc-pascal at lists.freepascal.org> wrote:
> FPC essentially reparses a generic during specialization so I'd say that
they definitely affect compile times.

Does c++  not “specialize” in one location like FPC? looking at c++ code I
often see things like Vector<x> used in multiple locations instead of
declaring a single type (I have no idea why they would do that but it’s
very common). Maybe that’s why compile times are so slow?

C++ specializes once per compilation unit (and per unique type parameters).
FPC does this as well, but in addition it will try to reuse a compatible
specialization that's located in the interface section of a used unit.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20180108/9d0feb44/attachment.html>

More information about the fpc-pascal mailing list