[fpc-pascal] 3123 inherited not supported inside inline

Michael Van Canneyt michael at freepascal.org
Sat Jun 24 17:27:07 CEST 2023

On Sat, 24 Jun 2023, Hairy Pixels via fpc-pascal wrote:

>> On Jun 24, 2023, at 7:18 PM, Michael Van Canneyt via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
>> According to Florian, inline should not be used to begin with, since the
>> compiler should be able to decide autonomously to inline a routine or not.
> Doesn't this mean the compiler can dictate the binary size by inlining everything even if the programmer doesn't want that?

If we assume the compiler is really stupid, then such an outcome is possible.

But why would it want to inline everything ?

The idea of inlining is to optimize code. I assume that the compiler will
be smart about it, and only inline when there is some gain to be had from

It seems to me no gain is to be had from e.g. inlining a routine of 500+ lines
of code.

Presumably, in such a scenario the compiler commandline flags 'optimize for speed' 
and 'optimize for size' will then come into play when it needs to decide what to do.

Worst case scenario: there is a {$INLINE ON/OFF} directive which allows you to
specify whether the compiler should even consider inlining or not.


More information about the fpc-pascal mailing list