[PD-dev] Bit fields in t_editor
Henri Augusto Bisognini
msndohenri at hotmail.com
Fri Feb 14 03:08:40 CET 2020
Quick C question: i was taking a look at struct _editor and I've noticed that the bitfields sum up to 6 with no (2 bits) padding for alignment.
typedef struct _editor
{
t_updateheader e_upd; /* update header structure */
[...]
unsigned int e_onmotion: 3; /* action to take on motion */
unsigned int e_lastmoved: 1; /* one if mouse has moved since click */
unsigned int e_textdirty: 1; /* one if e_textedfor has changed */
unsigned int e_selectedline: 1; /* one if a line is selected */
t_clock *e_clock; /* clock to filter GUI move messages */
int e_xnew; /* xpos for next move event */
[...]
} t_editor;
All the resources I've found on google used some padding (either manually or with a zero value).
My guess here is that since the next member is not a bit field then the compiler will align it for you. Is that right?
Cheers,
Henri.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20200214/dbf8e5e3/attachment.html>
More information about the Pd-dev
mailing list