[fpc-pascal] struct definition in C
Jonas Maebe
jonas.maebe at elis.ugent.be
Sun Mar 23 19:54:13 CET 2014
On 23/03/14 19:39, Darius Blaszyk wrote:
> What would be the equivalent of the following struct definition in C?
>
> typedef struct MyStruct
> {
> unsigned a :6;
> unsigned b :15;
> unsigned c:11;
> }MyStruct;
>
> I imagine this is some sort of struct initialization. Is thi spossible
> in FPC as well, or what is the best alternative?
It's not an initialization, it's a struct with bitfields. FPC currently
does not support C-compatible bitfield packing. To get a record with
equal alignment and size you can declare it as "record data: cuint;
end;", but there is currently no way in FPC to access the bitfields in a
portable way across platforms.
Jonas
More information about the fpc-pascal
mailing list