[Python-bugs-list] [ python-Bugs-468432 ] add more object sizes to struct

noreply@sourceforge.net noreply@sourceforge.net
Fri, 05 Oct 2001 16:32:47 -0700


Bugs item #468432, was opened at 2001-10-05 16:09
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=468432&group_id=5470

Category: Python Library
Group: Feature Request
Status: Open
Resolution: None
Priority: 5
Submitted By: paul rubin (phr)
Assigned to: Nobody/Anonymous (nobody)
Summary: add more object sizes to struct

Initial Comment:
It would be good if the struct module could deal with 64-bit, 32-bit, 4-bit,
and 1-bit objects.  It currently handles only 8 and 16 bits.  There's an 'I'
type which is the size of a C int, but that's 32 bits on some systems and
64 on others--maybe even 16 on some.  

I propose adding the format letters:

t- one bit
n (nibble) - 4 bits
q (quadbyte) - 32 bits
o (octbyte) - 64 bits

q and o should support signed and unsigned variants.  Signed bits and nibbles
probably aren't that useful, though they could be supported for completeness sake.


----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2001-10-05 16:32

Message:
Logged In: YES 
user_id=31435

struct has more than mode.

Native mode follows the platform C in all respects (size, 
alignment and endianness).

The standard modes are platform-independent, and 'i' 
and 'I' are 32 bits on all platforms in standard modes.  
2.2 struct also has corresponding 'q' and 'Q' format codes 
for signed and unsigned 64-bit ints in standard modes, and 
whatever "long long" means to C in native mode (or __int64 
in Windows native mode).

Note that the purpose of struct is for passing data in/out 
to/from C structs, and so non-C things like nibbles and 
bits are going to be a hard sell.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=468432&group_id=5470