Skip to content
Tcl Source Code History Of Ticket 1962090
Login

History Of Ticket 1962090

Artifacts Associated With Ticket 1962090

  1. Ticket change [176c28821b] (rid 122491) by nobody on 2008-05-11 22:46:30:

    1. assignee initialized to: "hobbs"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      I was trying to do some data validation, and ran across the following situation, which the example below demonstrates.
      
      % info patchlevel
      8.4.17
      % set s "5\n"
      5
      
      % string is double -strict $s
      1
      % expr {$s >= 0.0}
      1
      
      The string 's' is clearly not a double since it contains a control character, however the string test for double is returning true, which it should fail. The expr command is even more puzzling since the string is not a number, but the comparison returns true.
      
      IMHO both of these tests should return zero as the string is clearly not a double.
      
      
      
    4. foundin initialized to: "obsolete: 8.4.17"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "nobody"
    10. subsystem initialized to: "11. Conversions from String"
    11. title initialized to: "Failure of string and expr commands"
    12. type initialized to: "Bug"
  2. Ticket change [5da35c942f] (rid 115507) by hobbs on 2008-05-12 05:53:04:

    1. closedate changed to: "2008-05-11T22:53:04"
    2. closer changed to: "hobbs"
    3. icomment:
      Logged In: YES 
      user_id=72656
      Originator: NO
      
      To be clear, this control char is actually in the subspace of whitespace characters, which have more lenient handling at the C level.  It is no different than " 5 ", which is 5 as a number to strtod.
      
      BTW, the comparison <= is dangerous because it can do string comparisons, but you will see that it is a valid "integer" by doing + 1 as well.
      
      
    4. login: "hobbs"
    5. mimetype: "text/plain"
    6. resolution changed to: "Invalid"
    7. status changed to: "Closed"
    8. username: "hobbs"