On Mon, 15 Jul 2019, Sven Barth via fpc-devel wrote:
Ben Grasset <operato...@gmail.com> schrieb am Mo., 15. Juli 2019, 22:57:
On Sat, Jul 13, 2019 at 9:02 PM Sven Barth via fpc-devel <
fpc-devel@lists.freepascal.org> wrote:
Not necessarily. If you have two units that don't know about each other
that specialize the function with the same enum then you'd have two
specializations already.
Surely that only applies to what winds up in the PPUs for the units in
question, if anything, though? As opposed to the object files and the final
executable. Like, I don't see how it could possibly be the case that if two
/ three / four / e.t.c units all use Generics.Collections, and each one
contains an instance of something like:
var IntList: TList<LongInt>
that this means the resulting binary contains two / three / four /
e.t.c separate complete instantiations of TList for LongInt. You'd wind up
with executables in the literal hundreds-of-megabytes range if that were
so, even with optimizations / symbol stripping and so on activated.
That is exactly what is happening if you have a specialization in multiple
units that don't know about each other.
Indeed. And this is a very common scenario.
For this reason, I explicitly declare all specializations I need in a
separate unit. To make sure there is only 1 of them for each type.
Michael.
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel