Thanks for the pointer. I adapted the example like this: 
    
    
    const DIGITS = "0123456789"
    
    proc parseInt(s : string, radix: range[8..10]) : uint64 =
      var str = s
      result = 0
      
      for i in 0 .. str.high:
        let c = str[i]
        assert c in DIGITS[0 ..< radix]
        result = result * radix + uint64(DIGITS.find c)
    
    echo parseInt("077", 8)
    
    
    Run

It compiles, and seems to run as expected, but I get a warning which is hard to 
understand: 
    
    
    Hint: used config file '/nim/config/nim.cfg' [Conf]
    Hint: system [Processing]
    Hint: in [Processing]
    in.nim(9, 14) template/generic instantiation from here
    lib/system.nim(325, 3) Warning: Cannot prove that 'result' is initialized. 
This will become a compile time error in the future. [ProveInit]
    
    
    Run

It's complaining about the assert line - but I can't see the connection between 
that and result, and moreover result _is_ initialized at line 5, result = 0. 
Any ideas how to interpret this?

Reply via email to