Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
78ab583d
Kaydet (Commit)
78ab583d
authored
Nis 12, 2010
tarafından
Mark Dickinson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
More struct doc tweaks.
üst
b633f10f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
struct.rst
Doc/library/struct.rst
+13
-6
No files found.
Doc/library/struct.rst
Dosyayı görüntüle @
78ab583d
...
...
@@ -17,9 +17,13 @@ structs and the intended conversion to/from Python values.
.. note::
The string representation of a given C struct includes padding where
necessary by default. This is the same behavior as provided by most
C compilers. The padding may be disabled if desired.
By default, the result of packing a given C struct includes pad bytes in
order to maintain proper alignment for the C types involved; similarly,
alignment is taken into account when unpacking. This behavior is chosen so
that the bytes of a packed struct correspond exactly to the layout in memory
of the corresponding C struct. To omit pad bytes, use `standard` size and
alignment instead of `native` size and alignment: see :ref:`struct-alignment`
for details.
Functions and Exceptions
------------------------
...
...
@@ -202,10 +206,13 @@ For the ``'?'`` format character, the return value is either :const:`True` or
Either 0 or 1 in the native or standard bool representation will be packed, and
any non-zero value will be True when unpacking.
.. _struct-alignment:
Byte Order, Size, and Alignment
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
By default, C
number
s are represented in the machine's native format and byte
By default, C
type
s 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).
...
...
@@ -262,9 +269,9 @@ so the ``'P'`` format is not available.
Notes:
(1) Padding is only automatically added between successive structure members.
N
ever at the beginning of the string encoding and never at the end
.
N
o padding is added at the beginning or the end of the encoded struct
.
(2)
Padding is disabl
ed when using non-native size and alignment, e.g.
(2)
No padding is add
ed when using non-native size and alignment, e.g.
with '<', '>', '=', and '!'.
(3) To align the end of a structure to the alignment requirement of a
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment