[fpc-devel] [Suggestion] Enumeration range-check intrinsic

Sven Barth pascaldragon at googlemail.com
Tue Jul 16 11:20:19 CEST 2019


Ben Grasset <operator97 at gmail.com> schrieb am Di., 16. Juli 2019, 00:13:

> On Mon, Jul 15, 2019 at 5:50 PM Michael Van Canneyt <
> michael at freepascal.org> wrote:
>
>> As far as I know, they are not. I believe that when specializing, the
>> compiler checks if an identical specialization is in scope:
>> if so, it uses that. If not, a duplicate is made.
>>
>> As far as I know, Delphi behaves the same.
>>
>> Michael.
>>
>
> I was aware of the "identical specialization" check (or at least, I
> assumed it worked that way.)
>
> It still seems to me though that while heavy use of generics is certainly
> reflected in PPU size (for example, on x86_64 Windows, the release mode PPU
> of Generics.Collections.pas with my build of FPC is slightly over 30 MB)
> the PPU size does not really correspond to object file size or overall
> binary size (which again might be thanks to some stage of FPC itself, or
> the linker in the case of external ones, or both.)
>
> I suppose FPC does probably diverge from Delphi behavior at some point
> there too, as Delphi uses only DCUs, with no separate ".O"s.
>

The *declaration* of a generic is reflected in the size of the PPU as the
token stream is stored there. While *specializations* are reflected in the
compiled object code, aka the .o file.

Regards,
Sven

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20190716/8acc7812/attachment.html>


More information about the fpc-devel mailing list