summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/library/struct.rst57
1 files changed, 52 insertions, 5 deletions
diff --git a/docs/library/struct.rst b/docs/library/struct.rst
index 896c02793..026cb5e8a 100644
--- a/docs/library/struct.rst
+++ b/docs/library/struct.rst
@@ -6,11 +6,58 @@
|see_cpython_module| :mod:`python:struct`.
-Supported size/byte order prefixes: ``@``, ``<``, ``>``, ``!``.
-
-Supported format codes: ``b``, ``B``, ``h``, ``H``, ``i``, ``I``, ``l``,
-``L``, ``q``, ``Q``, ``s``, ``P``, ``f``, ``d`` (the latter 2 depending
-on the floating-point support).
+The following byte orders are supported:
+
++-----------+------------------------+----------+-----------+
+| Character | Byte order | Size | Alignment |
++===========+========================+==========+===========+
+| @ | native | native | native |
++-----------+------------------------+----------+-----------+
+| < | little-endian | standard | none |
++-----------+------------------------+----------+-----------+
+| > | big-endian | standard | none |
++-----------+------------------------+----------+-----------+
+| ! | network (= big-endian) | standard | none |
++-----------+------------------------+----------+-----------+
+
+The following data types are supported:
+
++--------+--------------------+-------------------+---------------+
+| Format | C Type | Python type | Standard size |
++========+====================+===================+===============+
+| b | signed char | integer | 1 |
++--------+--------------------+-------------------+---------------+
+| B | unsigned char | integer | 1 |
++--------+--------------------+-------------------+---------------+
+| h | short | integer | 2 |
++--------+--------------------+-------------------+---------------+
+| H | unsigned short | integer | 2 |
++--------+--------------------+-------------------+---------------+
+| i | int | integer (`1<fn>`) | 4 |
++--------+--------------------+-------------------+---------------+
+| I | unsigned int | integer (`1<fn>`) | 4 |
++--------+--------------------+-------------------+---------------+
+| l | long | integer (`1<fn>`) | 4 |
++--------+--------------------+-------------------+---------------+
+| L | unsigned long | integer (`1<fn>`) | 4 |
++--------+--------------------+-------------------+---------------+
+| q | long long | integer (`1<fn>`) | 8 |
++--------+--------------------+-------------------+---------------+
+| Q | unsigned long long | integer (`1<fn>`) | 8 |
++--------+--------------------+-------------------+---------------+
+| f | float | float (`2<fn>`) | 4 |
++--------+--------------------+-------------------+---------------+
+| d | double | float (`2<fn>`) | 8 |
++--------+--------------------+-------------------+---------------+
+| s | char[] | bytes | |
++--------+--------------------+-------------------+---------------+
+| P | void * | integer | |
++--------+--------------------+-------------------+---------------+
+
+.. _fn:
+
+(1) Requires long support when used with values larger than 30 bits.
+(2) Requires floating point support.
.. admonition:: Difference to CPython
:class: attention