• About C++ templates and Delphi generics and code bloat..

    From Wisdom90@21:1/5 to All on Wed Feb 26 12:18:53 2020
    Hello,


    About C++ templates and Delphi generics and code bloat..

    I have just read the following webpage about Delphi generics(that are
    like templates of C++) and code bloat:

    https://boyet.com/blog/delphi-oriented-generics-or-what-a-dog/


    I think Julian M Bucknall is way too pessimistic about Delphi, because
    what that means is: if you have Unit1.pas and Unit2.pas and both are
    using TList<Integer> both Unit1.dcu and Unit2.dcu have the binary code
    for TList<Integer> compiled in, but only when compiling your binary the
    linker will remove duplicates. So i think Delphi is the same as C++,
    because notice that C++ also has code bloat with templates:

    So read in the following it says:

    "In C++ code bloat occurs because compilers generate code for all
    templated functions in each translation unit that use them. Back in the
    day the duplicate code was not consolidated resulting in "code bloat".
    These days the duplicate code can be removed at link time."

    Read here:

    https://stackoverflow.com/questions/24333345/how-does-template-cause-the-code-bloat-in-c


    Thank you,
    Amine Moulay Ramdane.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)