[fpc-devel] enums and integer auto conversion

Jonas Maebe jonas.maebe at elis.ugent.be
Mon Sep 10 23:18:54 CEST 2012


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).


Jonas


More information about the fpc-devel mailing list