[fpc-devel] strange code in TThread in classesh.inc

Vincent Snijders vsnijders at quicknet.nl
Fri Sep 29 12:38:57 CEST 2006

Graeme Geldenhuys schreef:
> On 29/09/06, Tomas Hajny <XHajT03 at mbox.vol.cz> wrote:
>> What would be your suggestion - change it to {$IF defined(UNIX) or
>> defined(NETWLIBC)}? I'd say that it would be better to make the interface
>> completely common, i.e. to get rid of these IFDEFs completely (e.g. by
>> including a record defined in platform specific part of the unit).
>> Tomas
> Yeah, I just thought it is unnecessary code duplication and extra work
> if it has to be maintained.  The record idea sounds like a good plan
> and will get rid of the IFDEF's completely. Sound make the code much
> easier to read as well.

I won't argue the maintenance aspect, but I doubt your case for readability.

If you make this change, these fields are not in the same file as the class 
definition anymore, so I would have to look at two places. And the implementation 
becomes more unreadible.

Instead of
   FSem := 0;
It will be (assuming a record field name FPrivateData)
   FPrivateData.Sem := 0;


More information about the fpc-devel mailing list