[fpc-devel] Re: Illegal type conversion: "<enumeration type>"to"TObject"

Boian Mitov mitov at mitov.com
Sat Jul 19 01:07:40 CEST 2008


   Hi Thomas,

While your arguments are very true, this is a case where braking the rules 
comes with indeed less danger. Since the TStrings does not delete the 
objects, using dummy classes etc. requires a lot of support code and making 
sure at any point a string is deleted the object to be freed. This comes at 
a lot of extra code, and is extremely error prone. It almost guarantees that 
a mistake will be made at some point in complex project, and a memory leak 
is almost certain. "Illegal" typecasting in this case is indeed the lesser 
of the two evils, still ugly none the less, but I will take safe over ugly 
any day ;-) .

  With best regards,
    Boian Mitov

--------------------------------------------------------------------
Mitov Software
http://www.mitov.com
--------------------------------------------------------------------


----- Original Message ----- 
From: "Schatzl Thomas" <tom_at_work at gmx.at>
To: <fpc-devel at lists.freepascal.org>
Sent: Friday, July 18, 2008 2:21 PM
Subject: Re: [fpc-devel] Re: Illegal type conversion: "<enumeration 
type>"to"TObject"


> However, all other objections against typecasting still apply, i.e. it's 
> imho not too clean to typecast and breaks the -CR functionality and has 
> maybe other issues.




More information about the fpc-devel mailing list