[fpc-devel] Little feature teaser
pascaldragon at googlemail.com
Sat Aug 3 13:00:06 CEST 2013
On 03.08.2013 09:36, Sven Barth wrote:
> Am 02.08.2013 23:26 schrieb "Florian Klämpfl" <florian at freepascal.org
> <mailto:florian at freepascal.org>>:
> > Am 02.08.2013 17:46, schrieb Sven Barth:
> > > - 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...
> > >
> > At least I fixed loop unrolling for for-in loops.
> Cool! I'll need to test that with my test code :)
Hmm... am I expecting too much or is it really not working?
=== code begin ===
TLongIntArray = array[0..2] of LongInt;
function IsIn(aElement: LongInt; const aArray: TLongIntArray): Boolean;
for element in aArray do
if element = aElement then
Result := False;
MyArray: TLongIntArray = (42, 48, 39);
b := IsIn(42, MyArray);
=== code end ===
Tested with -O2, -O3 and -O4 and in all cases I still have the loop.
More information about the fpc-devel