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

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to