summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
d9db9c7)
Replace with a reference to the `align' class slot.
$C$__ilayout|, and if the relevant class is known at compile time then the
best way to discover the layout size is with the @|sizeof| operator. Failing
that, the size required to hold an instance of $C$ is available in a slot in
$C$__ilayout|, and if the relevant class is known at compile time then the
best way to discover the layout size is with the @|sizeof| operator. Failing
that, the size required to hold an instance of $C$ is available in a slot in
-$C$'s class object, as @|$C$__class@->cls.initsz|.
+$C$'s class object, as @|$C$__class@->cls.initsz|. The necessary alignment,
+in bytes, is provided as @|$C$__class@->cls.align|, should this be necessary.
It is not in general sufficient to declare, or otherwise allocate, an object
of the class type $C$. The class type only describes a single chain of the
It is not in general sufficient to declare, or otherwise allocate, an object
of the class type $C$. The class type only describes a single chain of the
sometimes move objects around in memory any more difficult than it needs to
be.
sometimes move objects around in memory any more difficult than it needs to
be.
-There isn't any way to discover the alignment required for a particular
-class's instances at runtime; it's best to be conservative and assume that
-the platform's strictest alignment requirement applies.
-
The following simple function correctly allocates and returns space for an
instance of a class given a pointer to its class object @<cls>.
\begin{prog}
The following simple function correctly allocates and returns space for an
instance of a class given a pointer to its class object @<cls>.
\begin{prog}