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

Schatzl Thomas tom_at_work at gmx.at
Fri Jul 18 23:21:26 CEST 2008


Hello,

> From: Craig Peterson <craig at scootersoftware.com>
> Message-ID: <48808C39.7030900 at scootersoftware.com>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> Schatzl Thomas wrote:
> > This will never compile directly on 64 bit platforms (x64/ppc64) because
> > afaik sizeof(enum) always <> sizeof(tobject) there. The original  poster
> > didn't mention his platform afaik.
> Sorry, Sean was out of the office yesterday. 
> 
> Boian hit it exactly;  we're doing this cast to store values in the 
> TStrings Objects[] property.  The current platform we're targeting is 
> Linux 32-bit, but we'll probably go to 64-bit at some point too, and it 
> would be nice if the cast continued to work as is.
> 
> AFAIK, none of the original Delphi code uses MinEnumSize, so it does 
> work there with 1 and 2 byte enumerations as well.

So this is not some regular type cast but some hack for Delphi - I fixed this in trunk by also allowing typecasts from enumerations (formerly only integers were allowed) to objects in Delphi mode. Due to the nature of the hack already present it also works on 64 bit platforms.
Sorry for taking so much time (and thanks for your perserverance ;)

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.

Regards,
  Thomas

-- 
GMX Kostenlose Spiele: Einfach online spielen und Spaß haben mit Pastry Passion!
http://games.entertainment.gmx.net/de/entertainment/games/free/puzzle/6169196



More information about the fpc-devel mailing list