[fpc-devel] C style operator doesn't work with properties in 2.3.1

Joao Morais post at joaomorais.com.br
Thu Jul 17 02:55:28 CEST 2008


Graeme Geldenhuys wrote:
> On Wed, Jul 16, 2008 at 4:29 PM, Marco van de Voort <marcov at stack.nl> wrote:
>>> After our discussion about not being able to use Include() with a
>>> class property, I thought I would then use the C Style += operator.
>>> After all that boils down to:  i += 2;    >>>>>   i := i + 2;
>> Suspect that it gets translated to inc(i,2); not i:=i+2; and then it makes
>> sense again, for the same reasons as before.
> 
> Boy of boy.... FPC 2.3.1 is becoming frustrating!!
> 
> So is there a performance difference between:
>    inc(i,2)    vs    i := i + 2;
> 
> If not, then can the += operator rather use the latter?  After all,
> just about every peace of documentation on += operator I could find,
> they mention that it's an shorthand form of x := x + y

Just if you want to know my humble opinion: your statement isn't fair. 
You know a property isn't a variable, so don't assume it will behave 
like that. If you want a property function as a variable, eg reading and 
writing a class member directly, do use a public variable instead. Fpc 
core is doing a really nice job, improving and extending the compiler in 
their spare time, helping all developers writing better source code. 
This one is a good sample. They don't deserve such comment.

--
Joao Morais



More information about the fpc-devel mailing list