binary format of 32-bit integer under Tcl 8.3

  • Follow


Hi,

I get error from ip package (from tcllib) under Tcl 8.3, even it should work 
for 8.2:

integer value too large to represent as non-long integer
    while executing
"binary format I [expr {$int}"
    (procedure "intToString" line 11)
    invoked from within
"intToString [maskToInt $x"
    (in namespace eval "::ip" script line 6)
    invoked from within
"namespace eval ::ip {
    variable maskLenToDotted
    variable x

    for {set x 0} {$x <33} {incr x} {
        set maskLenToDotted($x) [intToString [maskTo..."

I don't understand why is this problem for 8.3, since the $int value here is 
actually half of maximum size of 32-bit integer.

Is this just a bug in [binary format] in 8.3?
-- 
Pozdrawiam! (Regards!)
Googie
0
Reply Googie 11/22/2010 12:16:40 PM

Googie wrote:
> Hi,
> 
> I get error from ip package (from tcllib) under Tcl 8.3, even it should work 
> for 8.2:
> 
> integer value too large to represent as non-long integer
>     while executing
> "binary format I [expr {$int}"
>     (procedure "intToString" line 11)
>     invoked from within
> "intToString [maskToInt $x"
>     (in namespace eval "::ip" script line 6)
>     invoked from within
> "namespace eval ::ip {
>     variable maskLenToDotted
>     variable x
> 
>     for {set x 0} {$x <33} {incr x} {
>         set maskLenToDotted($x) [intToString [maskTo..."
> 
> I don't understand why is this problem for 8.3, since the $int value here is 
> actually half of maximum size of 32-bit integer.
> 
> Is this just a bug in [binary format] in 8.3?

It is not clear what you are doing but
if you start with index 0 your last valid bitposition is 31
i.e. your for loop must check condition should be {$x < 32}

uwe
0
Reply Uwe 11/22/2010 1:29:13 PM


1 Replies
480 Views

(page loaded in 0.017 seconds)

Similiar Articles:













7/24/2012 10:15:57 PM


Reply: