diff options
author | Fred Drake <fdrake@acm.org> | 2002-04-02 15:42:46 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2002-04-02 15:42:46 (GMT) |
commit | 103b548a76535720cd379ea6295958caa8e6e025 (patch) | |
tree | 89bd4a99331323e75117a950f8879de394a838b8 /Doc | |
parent | 64e5aa93919bb0ffd95a11a5da7bac64faaf9faf (diff) | |
download | cpython-103b548a76535720cd379ea6295958caa8e6e025.zip cpython-103b548a76535720cd379ea6295958caa8e6e025.tar.gz cpython-103b548a76535720cd379ea6295958caa8e6e025.tar.bz2 |
Add a note warning against semicolons following PyObject_HEAD.
Minor cleanups.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/ext/newtypes.tex | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Doc/ext/newtypes.tex b/Doc/ext/newtypes.tex index 46004ce..505f79a 100644 --- a/Doc/ext/newtypes.tex +++ b/Doc/ext/newtypes.tex @@ -59,9 +59,15 @@ This is what a Noddy object will contain. In this case nothing more than every Python object contains - a refcount and a pointer to a type object. These are the fields the \code{PyObject_HEAD} macro brings in. The reason for the macro is to standardize the layout and to -enable special debugging fields to be brought in debug builds. +enable special debugging fields in debug builds. Note that there is +no semicolon after the \code{PyObject_HEAD} macro; one is included in +the macro definition. Be wary of adding one by accident; it's easy to +do from habit, and your compiler might not complain, but someone +else's probably will! (On Windows, MSVC is known to call this an +error and refuse to produce compiled code.) -For contrast +For contrast, let's take a look at the corresponding definition for +standard Python integers: \begin{verbatim} typedef struct { @@ -70,8 +76,6 @@ typedef struct { } PyIntObject; \end{verbatim} -is the corresponding definition for standard Python integers. - Next up is: \begin{verbatim} @@ -491,7 +495,7 @@ newdatatype_print(newdatatypeobject *obj, FILE *fp, int flags) \end{verbatim} -\subsection{Attribute Management Functions} +\subsection{Attribute Management} For every object which can support attributes, the corresponding type must provide the functions that control how the attributes are |