[fpc-devel] Little feature teaser

Sven Barth pascaldragon at googlemail.com
Fri Aug 2 17:56:05 CEST 2013


On 02.08.2013 17:46, Sven Barth wrote:
> On 02.08.2013 17:34, Sven Barth wrote:
>> If you'd declare the "IsIn<T>" function as "inline" and the compiler
>> would correctly handle this(*1) the compiler could in theory be able to
>> fold the complete for-loop together in the example I gave (because only
>> constants are used there). I don't know though whether the compiler is
>> currently able to deduce this (I'll need to test that ^^).
>
> Just tested and got the following results:
> - the compiler uses indeed a for-loop for the for-in of arrays
> - inlining does not work with open array parameters yet (2.6.x at least
> warned about that, 2.7.1 does not warn about that anymore :( [at least
> the version I have lying around] )

According to the source the compiler does still provide a hint. Maybe I 
have hints disabled for my 2.7.1 version...

> - using an array declared as a ranged array (array[0..2] of LongInt) the
> for-loop is inlined and optimized a bit (especially depending on the
> optimization settings), but the compiler does not yet fold the loop...

Regards,
Sven



More information about the fpc-devel mailing list