It would be nice if [binary format] would do some
argument checking, and throw errors if the value
is incompatible with the format.
For example, the following script should cause an
error:
binary format s 40000
Since the value of 16-bit signed words is -32768 to
32767, the value of 40000 is illegal.
Logged In: YES
user_id=79902
I'm not convinced that's the right thing to do, especially
since there may be existing code that depends on being able
to convert (effectively) unsigned shorts into 16-bit values.
The real stickiness comes when you start to consider what's
going on with 32-bit systems. I think I'll put this on the
back burner for a while...
Logged In: YES
user_id=79902
Review of the documentation indicates that the current behaviour (taking the low-order 16-bits of
whatever integers are supplied) is correct. Changing this would not be backward compatible.