[fpc-devel] enums and integer auto conversion

Marco van de Voort marcov at stack.nl
Tue Sep 11 09:27:34 CEST 2012


In our previous episode, Dani?l Mantione said:
> Sets, are a bit more complicated: Their binary layout is defined in 
> Borland documentation, but this one of the few issues were FPC didn't 
> follow Borland. FPC has smallsets, up to 32 items and longsets, up to 256 
> items.

That's outdated, running

{$packset 4}

type TBit64=0..63;
     TBitSet64 = set of TBit64;

begin
  writeln(sizeof(tbitset64));
end.

yields "8".

Last week I had to add this packset in addition to $Mode delphi to compile delphi
code. 

A difference with Delphi is that delphi iirc also allows multiple of 1s, and
fpc only allows 1,2,4.. (multiples of 4 bytes)..32.

IIRC that had to do with endianess of sets, keeping them (d)word addressable.
The 4 byte magnitude doesn't scale to 8 byte on 64-bit though.




More information about the fpc-devel mailing list