<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html><body>
<p>Thanks Jonas!<br />One more question. Why is it that there is no portable way to access the bitfields? Is that because of endian issues, or is there more to it? What about declaring the bitfields in a bitpacked record as "array of boolean"?</p>
<p>Regards, Darius</p>
<p> </p>
<div> </div>
<p>Jonas Maebe schreef op 23 mrt '14:</p>
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px"><!-- html ignored --><!-- head ignored --><!-- meta ignored -->
<pre>On 23/03/14 19:39, Darius Blaszyk wrote:</pre>
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px">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?</blockquote>
<pre>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  -  <a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>
<a href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal</a>
</pre>
</blockquote>
</body></html>