packed enumerated types?

Eike Lange eike.lange at uni-essen.de
Fri Mar 28 10:22:26 CET 2003


On Fri, Mar 28, 2003 at 11:30:05AM +0800, Peter N Lewis wrote:
> set of (bold,italic,underlined)
> and fits inside a byte.  But of course the poor C folks can't do this 
> so they just use a byte and do all that bit twiddling.  But it seems 
> GPC requires 4 bytes for this, even if both the set and the subrange 
> are packed.  Is that correct?

Yes. Sets are mostly treated as Integers.

>  I presume there is no way to work 
> around this (and no, I'm not asking for it as a feature, just double 
> checking that it is not possible currently).

Could the following help you?

program Bar;
type
  TFace = packed record
    Bold, Italic, Underlined: Boolean
  end;
var
  x: TFace;
begin
  WriteLn (SizeOf (x))  { 1 Byte }
end.

Eike




More information about the Gpc mailing list