Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: ca6e0f12c703ad548038498c6194902275d5a2ca
Ticket: 221240ffffffffffffffffffffffffffffffffff
infinite loop - behaviour change from 8.0p2
User & Date: tjamesjones on 2000-11-03 17:18:06
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    
    [ couldn't find this in the bug database.
     surprisingly, this "bug" is also in v8.0.5  so it
     has been around for a while]
    
    we are trying to upgrade our version of Tcl from v8.0p2.
    have discovered an odd behaviour for this Tcl code:
    
    #
    # START CODE
    #
    
    set foo 0
    
    while $foo {
            puts "first loop"
    }
    
    set foo 1
    
    while { $foo != 0 } {
            set foo 0
            puts "second loop"
    
    }
    
    set foo 1
    
    while $foo {
            set foo 0
            puts "third loop"
    }
    
    #
    # END CODE
    #
    
    you can run it from tclsh - the code gets stuck in an infinite loop on the third loop.
    doesn't look right to me, yet I can't believe noone else has noticed this?   
    
    this broke some of our code, as the behaviour under v8.0p2 was more as you'd expect, breaking out of the third loop after one iteration.
    
    maybe Tcl has changed so that you can't say "while $var" although that doesn't really explain why it works for the first of the three loops.
    
    
    
    
    
  4. foundin changed to: "obsolete: 8.3.2"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "tjamesjones"
  9. subsystem changed to: "07. Variables"
  10. title changed to: "infinite loop - behaviour change from 8.0p2"
  11. type changed to: "Bug"