On 21.12.2013 02:11, Mark Morgan Lloyd wrote:
Sven Barth wrote:
On 20.12.2013 22:02, Mark Morgan Lloyd wrote:
A question if I may, leading on from
http://bugs.freepascal.org/view.php?id=25440

 > - inc(x)/dec(x) with range checking enabled are "optimized" with
 > taking address of x.

Is that why Inc() and Dec() can't be applied to properties, or are there
other issues?

http://wiki.freepascal.org/User_Changes_2.4.0#Treating_direct-mapped_properties_as_regular_fields

Noted, but I think my real question is whether the compiler could recognise 
that the optimisation is
inappropriate and instead generate +=n (with range checking).

Yes, the compiler was recognizing case with enabled range checking and generating "x:=x+n". However if "x" involves a function call (e.g. inc(somearray[foo()+2]); ) it is still necessary to avoid calling it twice, hence the optimization. I used quotes because the end result was opposite to the expected one.

Regards,
Sergei

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to