[docs] [issue12880] ctypes: clearly document how structure bit fields are allocated

Vlad Riscutia report at bugs.python.org
Fri Sep 30 19:19:11 CEST 2011


Vlad Riscutia <riscutiavlad at gmail.com> added the comment:

Attached doc update against tip (though I still hope my patch for configurable allocation strategies will make it in). 

This is my first doc patch so let me know if I missed something. I am basically explaining that bit field allocation is compiler-specific and no assumptions should be made of how a bitfield is allocated. 

I believe this is the better thing to do rather than detailing how GCC and MSVC allocated their bitfields because that would just encourage people to use this feature incorrectly. Most bugs opened on bit fields are because people are toying with the underlying buffer and get other results than what they expect. IMO, when using bitfields one should only access the structure members at a high level and not go read/write the raw memory underneath.

----------
keywords: +patch
Added file: http://bugs.python.org/file23275/bitfield_doc.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12880>
_______________________________________


More information about the docs mailing list