[fpc-devel] enums and integer auto conversion

Daniël Mantione daniel.mantione at freepascal.org
Mon Sep 10 23:42:06 CEST 2012

Op Mon, 10 Sep 2012, schreef Jonas Maebe:

> On 10 Sep 2012, at 23:12, Daniël Mantione wrote:
>> Op Mon, 10 Sep 2012, schreef Jonas Maebe:
>>> If you want to do that, you need to add a layer in between that converts the sets into integer bitmasks in a reliable, portable and future-proof way.
>> Yes! Let's also convert integers to enums with a case statement rather 
>> than typecast, just in case the compiler may not count enums from zero 
>> in the future ;)
> You can explicitly define the ordinal values of enumerations if you 
> depend on that sort of stuff (which afaik the Qt units in fact do).

That's a rewriting of history, as we invented that feature. Obviously 
people were writing interfaces to external libraries before that. Were 
those programmers wrong? Not at all, they could succesfully rely on 
guaranteed binary representations in Borland manuals.


More information about the fpc-devel mailing list