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

Graeme Geldenhuys graemeg.lists at gmail.com
Thu Jul 17 08:41:18 CEST 2008


On Thu, Jul 17, 2008 at 2:55 AM, Joao Morais <post at joaomorais.com.br> wrote:
> 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.

My bad.  I had one of those off developer days yesterday. ;-)  And it
seemed everything I tried under FPC 2.3.1 did not work as expected,
where they did in 2.2.3 and prior.

eg:  I inherited some code from another project that I now need to
amend to compile with FPC 2.3.1. Yes it's not the best looking code,
but it works and I'm pushed for time, so code clean-up needs to wait.

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;


Maybe it's just me, but the first two lines are much easier to read
and less prone to typing errors.

And yes, I really do appreciate what the FPC core team are doing. They
have done a wonderful job so far, and the reason our company will
continue using FPC in the future. Unfortunately I'm not a compiler
developer, so I can only comment from an applications developer point
of view.


Regards,
 - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/



More information about the fpc-devel mailing list