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

Daniël Mantione daniel.mantione at freepascal.org
Thu Jul 17 09:09:13 CEST 2008



Op Thu, 17 Jul 2008, schreef Micha Nelissen:

> Graeme Geldenhuys wrote:
>> Simple one liners like the following:
>>
>>    inc(FDayList[itm.WeekDayNum].Rows[itm.Timeslot].AvailableSlots,
>> itm.CountSlots);
>> or
>>    FDayList[itm.WeekDayNum].Rows[itm.Timeslot].AvailableSlots += 
>> itm.CountSlots;
>> 
>> now has to change to this ugly line...
>>
>>    FDayList[itm.WeekDayNum].Rows[itm.Timeslot].AvailableSlots :=
>>       FDayList[itm.WeekDayNum].Rows[itm.Timeslot].AvailableSlots +
>> itm.CountSlots;
>
> Or:
>
> tempRow := FDayList[itm.WeekDayNum].Rows[itm.Timeslot];
> tempRow.AvailableSlots := tempRow.AvailableSlots + itm.CountSlots;
>
> Assuming .Rows[X] results in a class instance.

Even shorter:

with itm do
   with FDayList[WeekDayNum].Rows[Timeslot] do
     AvailableSlots:=AvailableSlots+CountSlots;

Daniël


More information about the fpc-devel mailing list