[fpc-devel] Inc() and Dec() on properties

Mark Morgan Lloyd markMLl.fpc-devel at telemetry.co.uk
Fri Dec 20 23:11:55 CET 2013


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).

Frankly, I'm fairly happy with the += idiom but I appreciate that there 
are some people who object that "it's not Pascal". I think that an 
alternative to having to repeat the full name of a deep property is 
desirable: it's obviously possible to use  with  but some people don't 
like that either :-)

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-devel mailing list