summaryrefslogtreecommitdiffstats
path: root/Doc/lib/libstruct.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/lib/libstruct.tex')
-rw-r--r--Doc/lib/libstruct.tex17
1 files changed, 15 insertions, 2 deletions
diff --git a/Doc/lib/libstruct.tex b/Doc/lib/libstruct.tex
index 026968c..539e937 100644
--- a/Doc/lib/libstruct.tex
+++ b/Doc/lib/libstruct.tex
@@ -50,14 +50,15 @@ C and Python values should be obvious given their types:
\lineiv{c}{\ctype{char}}{string of length 1}{}
\lineiv{b}{\ctype{signed char}}{integer}{}
\lineiv{B}{\ctype{unsigned char}}{integer}{}
+ \lineiv{t}{\ctype{_Bool}}{bool}{(1)}
\lineiv{h}{\ctype{short}}{integer}{}
\lineiv{H}{\ctype{unsigned short}}{integer}{}
\lineiv{i}{\ctype{int}}{integer}{}
\lineiv{I}{\ctype{unsigned int}}{long}{}
\lineiv{l}{\ctype{long}}{integer}{}
\lineiv{L}{\ctype{unsigned long}}{long}{}
- \lineiv{q}{\ctype{long long}}{long}{(1)}
- \lineiv{Q}{\ctype{unsigned long long}}{long}{(1)}
+ \lineiv{q}{\ctype{long long}}{long}{(2)}
+ \lineiv{Q}{\ctype{unsigned long long}}{long}{(2)}
\lineiv{f}{\ctype{float}}{float}{}
\lineiv{d}{\ctype{double}}{float}{}
\lineiv{s}{\ctype{char[]}}{string}{}
@@ -70,6 +71,11 @@ Notes:
\begin{description}
\item[(1)]
+ The \character{t} conversion code corresponds to the \ctype{_Bool} type
+ defined by C99. If this type is not available, it is simulated using a
+ \ctype{char}. In standard mode, it is always represented by one byte.
+ \versionadded{2.6}
+\item[(2)]
The \character{q} and \character{Q} conversion codes are available in
native mode only if the platform C compiler supports C \ctype{long long},
or, on Windows, \ctype{__int64}. They are always available in standard
@@ -118,6 +124,12 @@ example, the Alpha and Merced processors use 64-bit pointer values,
meaning a Python long integer will be used to hold the pointer; other
platforms use 32-bit pointers and will use a Python integer.
+For the \character{t} format character, the return value is either
+\constant{True} or \constant{False}. When packing, the truth value
+of the argument object is used. Either 0 or 1 in the native or standard
+bool representation will be packed, and any non-zero value will be True
+when unpacking.
+
By default, C numbers are represented in the machine's native format
and byte order, and properly aligned by skipping pad bytes if
necessary (according to the rules used by the C compiler).
@@ -151,6 +163,7 @@ for any type (so you have to use pad bytes);
\ctype{long long} (\ctype{__int64} on Windows) is 8 bytes;
\ctype{float} and \ctype{double} are 32-bit and 64-bit
IEEE floating point numbers, respectively.
+\ctype{_Bool} is 1 byte.
Note the difference between \character{@} and \character{=}: both use
native byte order, but the size and alignment of the latter is