Overview
| Artifact ID: | 7ae5ac01d9031c7c14ed76fbc997de6994476414 |
|---|---|
| Ticket: | 1527169fffffffffffffffffffffffffffffffff
[scan] incompatibility |
| User & Date: | kennykb on 2006-07-30 23:51:38 |
Changes
- icomment:
Logged In: YES user_id=99768 Alas, Tcl has had a great many inconsistencies over time with the way that integers larger than the precision of the machine are handled, and the way that differences among machines are handled. Moving forward, we've taken the approach in 8.5 that Tcl's integers are of arbitrary precision, and provided %llx, %llo, %llu and %lld format groups that work the same on all platforms. We've also adopted the idea that %x, %o, %u and %d are the width of a native 'long int' or 'long unsigned int' - whatever that is on the platform - and that %lx, %lo, %lu, and %ld are the width of a 'long long' (or __int64 in the Microsoft compilers) or 'unsigned long long' (unsigned __int64). This does indeed introduce a handful of incompatibilities, but it also fixes a number of insidious bugs, of which the ones mentioned in TIP #237 are representative. To constrain an integer to 'signed 32-bit', irrespective of the platform's integer width or the input format, the easiest thing at present is to combine the bit weights yourself: expr {($x & 0x7fffffff) - ($x & 0x80000000)} This expression will give the value of the least significant 32 bits of any integer, interpreted as a signed (twos-complement) 32-bit quantity. - login: "kennykb"
- mimetype: "text/plain"
- username: "kennykb"