Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 6ba3476db8eb984231d4d8a733a115d9d6b10cf2
Ticket: cd29ba23cc373c087f14305c3a3135d797ac4ac5
scan %i
User & Date: beric on 2016-10-05 07:32:18
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-fossil-wiki"
  4. comment changed to:
    According to the documentation, <i>%i scans an integer with the base (i.e. decimal, binary, octal, or hexadecimal) determined in the same fashion as described in expr.</i>
    
    So one can expect:
    
    <pre>
      scan 0b10 %i v ;# v = 2 expected, but is 0
      scan 0o77 %i v ;# v = 63 expected, but is 0
    </pre>
    
    Also note that:
    
    <pre>
      scan 0xf %i v ;# v = 15
      scan 077 %i v ;# v = 63
    </pre>
    
    The test scan-4.41 in scan.test, line 337 is also buggy:
    
    <pre>
    test scan-4.41 {Tcl_ScanObjCmd, base-unknown integer scanning} -setup {
        set x {}
    } -body {
        list [scan {10 010 0x10 0b10} {%i%i%i%i} x y z t] $x $y $z $t
    } -result {4 10 8 16 0}
    </pre>
    
    The flag TCL_PARSE_SCAN_PREFIXES set in tclScan.c for %i is documented as <i>ignore prefixes</i> in tclStrToD.c.
    
  5. foundin changed to: "8.6.6"
  6. is_private changed to: "0"
  7. login: "beric"
  8. priority changed to: "5 Medium"
  9. resolution changed to: "None"
  10. severity changed to: "Critical"
  11. status changed to: "Open"
  12. submitter changed to: "beric"
  13. subsystem changed to: "23. [scan]"
  14. title changed to: "scan %i"
  15. type changed to: "Bug"