On 27 Feb 2008, at 13:55, Vinzent Hoefler wrote:

On Wednesday 27 February 2008 12:21, Daniël Mantione wrote:


I.e. we can
exchange packed records with TP/Delphi, what would be the problem
with bitpacking? If I recall well, Jonas made our bitpacking
compatible with GCC and GNU-Pascal.

Great. And surely the PCI-board registers are compatible with GCC (oh,
and if so, which compiler version then?).

C bitpacking is not "GCC-compatible" or not. C bitpacking is defined in the ABI for each platform (apart from the __attribute__((__packed__)) case, where the packing /is/ GCC-specific).

And yes, that means it's unsuited for hardware interfacing. You can hack around it (I repeat, this is a hack) by a) using cases which are equal on all current ABIs (although this is not guaranteed to remain so by anyone in any way) like a.o. not using bitfields which span a byte/word/dword boundary (depending on the size of the bitfield and the bitfields coming before it) b) taking into account the endianess of the host platform (since bitfields start counting from the most significant bit of big endian systems and from the least significant bit on little endian systems).


Jonas_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to