Description: |
Hemang,
You have indeed found a bug in the scan command. This occured
when 'scan' was rewritten for 8.1 to support unicode. The problem
is rather simple - it won't read past the "0x...", so you are
always scanning the 0 before the x. You can see this with:
scan 0x001 %xx%x
=> 0 1
The workaround is to do:
set a [expr $a]
and then the scan. This does need to be reported to SourceForge
as well. Is this something that you will also need corrected in
the IOS port?
Thanks,
Jeff Hobbs The Tcl Guy
Senior Developer http://www.ActiveState.com/
Tcl Support and Productivity Solutions
> -----Original Message-----
> From: Hemang Lavana [mailto:[email protected]]
> Sent: December 19, 2001 1:12 PM
> To: [email protected]
> Cc: [email protected]; [email protected]
> Subject: Bug in scan command?
>
>
> Hello Jeff,
>
> Is this a bug in scan command? I tried these commands in tcl8.3.4.1
> version on win2k and got the same results. Note that ATS3.2 contains
> tcl8.0.5 version and ATS3.4 contains tcl8.3.3 version.
>
> % package provide ActiveTcl
> 8.3.4.1
> (bin) 2 % set a 0x0001
> 0x0001
> (bin) 3 % scan $a %x a
> 1
> (bin) 4 % puts $a
> 0
> (bin) 5 % scan 0xff %x
> 0
>
> Let me know if you want me to file a bug on SF.
>
> Thanks,
> Hemang.
|
User Comments: |
hobbs added on 2002-02-07 08:44:44:
File Added - 17391: 495213.patch
Logged In: YES
user_id=72656
oddly enough, scan-4.40 had a test that relied on the
incorrect behavior. I have the feeling noone bothered to
check that the result was wrong, since it is inconsistent
with 8.0 and C's scanf. Attached is the patch for 8.4a4cvs
that should apply to 8.3.4cvs as well (simple fix).
|