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
dbadd558
Kaydet (Commit)
dbadd558
authored
Ock 03, 1997
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Describe standard float/double support.
Rewrite example to be an interactive session
üst
b9a781e1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
12 deletions
+20
-12
libstruct.tex
Doc/lib/libstruct.tex
+10
-6
libstruct.tex
Doc/libstruct.tex
+10
-6
No files found.
Doc/lib/libstruct.tex
Dosyayı görüntüle @
dbadd558
...
...
@@ -101,8 +101,8 @@ expression. This is always combined with native byte order.
Standard size and alignment are as follows: no alignment is required
for any type (so you have to use pad bytes); short is 2 bytes; int and
long are 4 bytes.
In this mode, there is no support for float and
double (
\code
{
'f'
}
and
\code
{
'd'
}
)
.
long are 4 bytes.
Float and double are 32-bit and 64-bit IEEE floating
point numbers, respectively
.
Note the difference between
\code
{
'@'
}
and
\code
{
'='
}
: both use native
byte order, but the size and alignment of the latter is standardized.
...
...
@@ -119,10 +119,14 @@ Examples (all using native byte order, size and alignment, on a
big-endian machine):
\bcode
\begin{verbatim}
from struct import *
pack('hhl', 1, 2, 3) == '
\0
00
\0
01
\0
00
\0
02
\0
00
\0
00
\0
00
\0
03'
unpack('hhl', '
\0
00
\0
01
\0
00
\0
02
\0
00
\0
00
\0
00
\0
03') == (1, 2, 3)
calcsize('hhl') == 8
>>> from struct import *
>>> pack('hhl', 1, 2, 3)
'
\0
00
\0
01
\0
00
\0
02
\0
00
\0
00
\0
00
\0
03'
>>> unpack('hhl', '
\0
00
\0
01
\0
00
\0
02
\0
00
\0
00
\0
00
\0
03')
(1, 2, 3)
>>> calcsize('hhl')
8
>>>
\end{verbatim}
\ecode
Hint: to align the end of a structure to the alignment requirement of
...
...
Doc/libstruct.tex
Dosyayı görüntüle @
dbadd558
...
...
@@ -101,8 +101,8 @@ expression. This is always combined with native byte order.
Standard size and alignment are as follows: no alignment is required
for any type (so you have to use pad bytes); short is 2 bytes; int and
long are 4 bytes.
In this mode, there is no support for float and
double (
\code
{
'f'
}
and
\code
{
'd'
}
)
.
long are 4 bytes.
Float and double are 32-bit and 64-bit IEEE floating
point numbers, respectively
.
Note the difference between
\code
{
'@'
}
and
\code
{
'='
}
: both use native
byte order, but the size and alignment of the latter is standardized.
...
...
@@ -119,10 +119,14 @@ Examples (all using native byte order, size and alignment, on a
big-endian machine):
\bcode
\begin{verbatim}
from struct import *
pack('hhl', 1, 2, 3) == '
\0
00
\0
01
\0
00
\0
02
\0
00
\0
00
\0
00
\0
03'
unpack('hhl', '
\0
00
\0
01
\0
00
\0
02
\0
00
\0
00
\0
00
\0
03') == (1, 2, 3)
calcsize('hhl') == 8
>>> from struct import *
>>> pack('hhl', 1, 2, 3)
'
\0
00
\0
01
\0
00
\0
02
\0
00
\0
00
\0
00
\0
03'
>>> unpack('hhl', '
\0
00
\0
01
\0
00
\0
02
\0
00
\0
00
\0
00
\0
03')
(1, 2, 3)
>>> calcsize('hhl')
8
>>>
\end{verbatim}
\ecode
Hint: to align the end of a structure to the alignment requirement of
...
...
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