Overview
| Artifact ID: | b7dfe83d35e7bb235b93f22313325fd0d4e0559d |
|---|---|
| Ticket: | 1600214fffffffffffffffffffffffffffffffff
why execute the same script in Solaris and AIX is different? |
| User & Date: | dgp on 2006-11-22 00:07:44 |
Changes
- closedate changed to: "2006-11-21T17:07:44"
- closer changed to: "dgp"
- icomment:
Logged In: YES user_id=80530 Originator: NO Tcl 8.4.0 added "wide" integers back in 2002, and when they came in, some of the rules for interpreting the value of literals changed to support them. In this case, the literal "0x80000001" now means "2147483649" and not "-2147483647". See TIP 72 for details. This is entirely a Tcl 8.3 -> 8.4 change. Platform switch has nothing to do with it in this case. See these interactive sessions on one system: % info patch 8.3.5 % set x 0x80000001 0x80000001 % set y -2147483647 -2147483647 % expr {$x==$y} 1 % info patch 8.4.15 % set x 0x80000001 0x80000001 % set y -2147483647 -2147483647 % expr {$x==$y} 0 Please note that your code has never been portable to a 64-bit system: % info patch 8.3.5 % set x 0x80000001 0x80000001 % set y -2147483647 -2147483647 % expr {$x==$y} 0 The only portable way to limit integer values exactly to a 32-bit range in [expr] is with masking: % expr {($x&0xFFFFFFFF)==($y&0xFFFFFFFF)} 1 Alternatively, you might want to [binary format] your values and compare the resulting byte sequences, if that's the comparison you're really trying to accomplish. % set bx [binary format i $x] % set by [binary format i $y] % expr {$bx eq $by} 1 - login: "dgp"
- mimetype: "text/plain"
- resolution changed to: "Invalid"
- status changed to: "Closed"
- subsystem changed to: "48. Number Handling"
- username: "dgp"