[fpc-devel] enums and integer auto conversion

Jonas Maebe jonas.maebe at elis.ugent.be
Tue Sep 11 09:23:50 CEST 2012

On 11 Sep 2012, at 06:18, Alexander Klenin <klenin at gmail.com> wrote:

> How about packed sets? Do they have well-defined memory layout? If
> not, then maybe they should?

Set packing only influences the number of bytes occupied by sets, not their internal layout. And I don't think that should change, because they are orthogonal issues. You'd need a new directive that would enable unambiguously specifying the layout of sets. That would require a lot of code generator changes though.

And as an aside, using sets to represent bitmasks isn't even possible today if you want portable code, because the current layout on big endian systems does not correspond to or'ing (1 shl ord(enumval)). You could of course start changing the ordinal values of the enums on big endian systems to compensate, but then you get in trouble if they are sometimes also used in a non-bitmask context.


More information about the fpc-devel mailing list