diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2012-05-16 23:23:29 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2012-05-16 23:23:29 (GMT) |
commit | e814b4bdc0ee23702032fd890020a810f955083a (patch) | |
tree | 31f1f431f681cb9ee80d8c4b1110804f4b4ce10f /doc | |
parent | ca0b1fad5957e992b539011836161b5f62324a32 (diff) | |
parent | c499b7e4c09fd90b4981a87ef411e83ea4c28d2d (diff) | |
download | tcl-e814b4bdc0ee23702032fd890020a810f955083a.zip tcl-e814b4bdc0ee23702032fd890020a810f955083a.tar.gz tcl-e814b4bdc0ee23702032fd890020a810f955083a.tar.bz2 |
[Bug 3525462]: Document what relational operators really do with string args.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/expr.n | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -326,6 +326,7 @@ returns \fB4.0\fR, not \fB4\fR. String values may be used as operands of the comparison operators, although the expression evaluator tries to do comparisons as integer or floating-point when it can, +i.e., when all arguments to the operator allow numeric interpretations, except in the case of the \fBeq\fR and \fBne\fR operators. If one of the operands of a comparison is a string and the other has a numeric value, a canonical string representation of the numeric @@ -337,12 +338,11 @@ is that produced by the \fB%g\fR format specifier of Tcl's .PP .CS \fBexpr\fR {"0x03" > "2"} -\fBexpr\fR {"0y" < "0x12"} +\fBexpr\fR {"0y" > "0x12"} .CE .PP both return 1. The first comparison is done using integer -comparison, and the second is done using string comparison after -the second operand is converted to the string \fB18\fR. +comparison, and the second is done using string comparison. Because of Tcl's tendency to treat values as numbers whenever possible, it is not generally a good idea to use operators like \fB==\fR when you really want string comparison and the values of the |