Skip to content
Tcl Source Code View Ticket
Login

View Ticket

binary command and arg checking

Closed / Invalid483359ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 25 years ago
Descriptionplain2001-11-19 12:21:23
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.
dkfplain2001-12-05 21:05:41
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...
dkfplain2002-01-03 17:39:33
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.
Log in (anonymous is fine) to add a comment.