-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: gtk-text-attributes cstruct is incorrect #67
Comments
Yeah I'm super angry with GTK using bitfields in public structs. Ideally those were supported in CFFI. If you really need it ... I suspect writing the wrapper in C is less work than supporting the correct sizes and alignment etc. in CFFI. But you might already have done that? :) Btw. GTK also fails to properly support these in their XML output (that is, via the GObject introspection), so no, that can't be used either to compute the correct offsets (the required fields are there, they just don't set them at all). I'm actually kind of at a loss of how to reliably arrive at the same layout as the C compiler would. |
I believe layout of packed bitfields is not defined by the standard. Compilers have flags that affect structure packing behavior, making the situation very unreliable. I always assumed bitfields are packed into ints conceptually, but that is guesswork; in this case other members follow, which makes the offsets impossible to derive reliably. |
I hate the idea of writing an extra C wrapper - the last time I went that route I wound up writing so much C that I was wondering why not just write the whole application in C... |
Right, but all wrappers still won't allow us to access bitfields (reliably), right? |
I can't think of a compiler that does not align to nearest power-of-two for bytes and pack bitfields. I suppose we should dig through the spec, although just thinking about it give mes the willies. After a brief stint on X3J11, I never want to see C++ specs ever again. |
See gtk/gtk.text-tag.lisp - at the end, it is:
while recent gtk documentation shows
So there are 4 single-bit packed values, and 3 more are missing.
The text was updated successfully, but these errors were encountered: