From e4ea29d8e1853f8ae36ee0e65b9f5913303042d2 Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Wed, 2 Aug 2017 10:44:02 +0100 Subject: [PATCH] doc/concepts.tex: A number of minor fixes. Organization: Straylight/Edgeware From: Mark Wooding * Insert a missing paren. * Insert missing space after `\Cplusplus'. * Hyphenate `pointer-to-class-type' in the description of conversions, because it's easy to mis-associate otherwise. * Fix erroneous (probably copy-and-paste) `upcast' to `downcast'. * Improve wording about failing downcasts. --- doc/concepts.tex | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/concepts.tex b/doc/concepts.tex index 8067739..64f6320 100644 --- a/doc/concepts.tex +++ b/doc/concepts.tex @@ -270,7 +270,7 @@ slots. If you want to hide implementation details, the best approach is to stash them in a dynamically allocated private structure, and leave a pointer to it in a slot. (This will also help preserve binary compatibility, because the private structure can grow more members as needed. See -\xref{sec:fixme.compatibility} for more details. +\xref{sec:fixme.compatibility} for more details.) \subsubsection{Vtables} @@ -291,8 +291,8 @@ doesn't define any messages, so it doesn't have any methods. In Sod, a class slot containing a function pointer is not at all the same thing as a method.) \subsubsection{Conversions} -Suppose one has a value of type pointer to class type of some class~$C$, and -wants to convert it to a pointer to class type of some other class~$B$. +Suppose one has a value of type pointer-to-class-type for some class~$C$, and +wants to convert it to a pointer-to-class-type for some other class~$B$. There are three main cases to distinguish. \begin{itemize} \item If $B$ is a superclass of~$C$, in the same chain, then the conversion @@ -308,13 +308,13 @@ There are three main cases to distinguish. pointer. The conversion can be performed using the appropriate generated upcast macro (see below); the general case is handled by the macro \descref{SOD_XCHAIN}{mac}. -\item If $B$ is a subclass of~$C$ then the conversion is an \emph{upcast}; +\item If $B$ is a subclass of~$C$ then the conversion is a \emph{downcast}; otherwise the conversion is a~\emph{cross-cast}. In either case, the conversion can fail: the object in question might not be an instance of~$B$ - at all. The macro \descref{SOD_CONVERT}{mac} and the function + after all. The macro \descref{SOD_CONVERT}{mac} and the function \descref{sod_convert}{fun} perform general conversions. They return a null pointer if the conversion fails. (There are therefore your analogue to the - \Cplusplus @|dynamic_cast<>| operator.) + \Cplusplus\ @|dynamic_cast<>| operator.) \end{itemize} The Sod translator generates macros for performing both in-chain and cross-chain upcasts. For each class~$C$, and each proper superclass~$B$ -- [mdw]