From 99fca9a58949436b350c761c31390c80a33af674 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sat, 3 Aug 2019 16:47:15 +0100 Subject: [PATCH 1/1] doc/concepts.tex: Delete `no way to discover alignment for instance' claim. Replace with a reference to the `align' class slot. --- doc/concepts.tex | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/doc/concepts.tex b/doc/concepts.tex index eae67aa..67dc35b 100644 --- a/doc/concepts.tex +++ b/doc/concepts.tex @@ -940,7 +940,8 @@ layout of an instance of some class~$C$ is described by the type @|struct $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 @@ -956,10 +957,6 @@ instances, so, for example, Sod doesn't make using fancy allocators which 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 @. \begin{prog} -- 2.11.0