Struct usage and varying sizes of h, l, etc

Ethan Furman efurman at admailinc.com
Tue May 20 18:36:25 EDT 2008


Greetings,

I'm looking at the struct module for binary packing of ints and floats.  
The documentation refers to C datatypes.  It's been many years since I 
looked at C, but I seem to remember that the data type sizes were not 
fixed -- for example, an int might be two byes on one machine, and four 
bytes on the next.  Can any C programmers verify this?  If it is true, 
does that mean that struct.pack('h', 8001) might give me different 
results depending on the machine it's running on?

Thanks for any help!
--
Ethan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080520/01e6e381/attachment.html>


More information about the Python-list mailing list