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

Craig Peterson craig at scootersoftware.com
Fri Jul 18 14:27:37 CEST 2008


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.

Craig




More information about the fpc-devel mailing list