X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/a42893dda5f4dd2b89fbfe4e497da261159225ca..42291726898a019030c265b1063eac5d1d7bf173:/lib/sod-structs.3 diff --git a/lib/sod-structs.3 b/lib/sod-structs.3 index 029cabd..7ac5ccc 100644 --- a/lib/sod-structs.3 +++ b/lib/sod-structs.3 @@ -97,7 +97,7 @@ struct SodClass__vt_obj { \h'2n'} obj; }; -struct SodObject__ilayout { +struct SodClass__ilayout { \h'2n'union { \h'4n'struct SodClass__ichain_obj { \h'6n'const struct SodClass__vt_obj *_vt; @@ -105,6 +105,7 @@ struct SodObject__ilayout { \h'8n'const char *name; \h'8n'const char *nick; \h'8n'size_t initsz; +\h'8n'size_t align; \h'8n'void *(*imprint)(void *\fIp\fB); \h'8n'size_t n_supers; \h'8n'const SodClass *const *supers; @@ -334,6 +335,9 @@ A pointer to the class's nickname. .B size_t initsz; The size in bytes required to store an instance of the class. .TP +.B size_t align; +A sufficient alignment for the class's instance storage. +.TP .BI "void *(*imprint)(void *" p ); A pointer to a function: given a pointer @@ -622,13 +626,9 @@ for each of superclasses .IR A in the same chain in some (unimportant) order. -A `pointer to -.IR C ' -is always assumed -(and, indeed, defined in C's type system) -to be a pointer to the -.B struct -.IB C __ichain_ h \fR. +The (somewhat obtuse) purpose of this union is to +engage the `common initial sequence' rule of +C99 (clause 6.5.2.3). .PP The .B ichain @@ -660,6 +660,14 @@ then the last member is .IB C __islots .IB c ; .PP +A `pointer to +.IR C ' +is always assumed +(and, indeed, defined in C's type system) +to be a pointer to the +.B struct +.IB C __ichain_ h \fR. +.PP Finally, the .B islots structure simply contains one member for each slot defined by @@ -731,6 +739,12 @@ extern const union \fIC\fB__vtu_\fIh\fB \fIC\fB__vtable_\fIh\fB; .ft P .fi .PP +In the following, +let +.I M +be the metaclass of +.IR C . +.PP The outer layer is a .B union .IB C __vtu_ h