Skip to content
Tcl Source Code Artifact [38506fd9d4]
Login

Artifact [38506fd9d4]

Artifact 38506fd9d44712ab65734a9943df721a87beb764:

Ticket change [38506fd9d4] - Ticket [ef5373e6fa0617ee|ef5373e6fa] <i>expr, literal numeric values, and string comparisons</i> status still Open with 3 other changes by dkf on 2016-10-30 17:40:11.
D 2016-10-30T17:40:11.975
J comment The\sdocumentation\sfor\s<code>expr</code>\sprovides\sseven\srules\sfor\soperand\r\nsyntax.\s\sOf\sthose,\sthe\svalue\s<code>0x12</code>\smatches\srule\s1,\sand\sonly\srule\s1:\r\n"<i>...\sa\snumeric\svalue,\seither\sinteger\sor\sfloating-point</i>".\s\sTherefore,\r\n<code>0x12</code>\sis\sunambiguously\sa\snumeric\svalue.\s\sThe\sstring\srepresentation\r\nof\s<code>0x12</code>\sis\s<code>18</code>,\sas\sillustrated\sby\sthe\sresult\sof\r\n<code>[expr\s0x12]</code>.\s\sFurthermore,\sthe\sdocumentation\sstates\sthat\soperands\r\nthat\sare\snot\snumeric\sor\sboolean\smust\sbe\squoted.\s\sIt's\swell-accepted\sthat\sonly\r\nnumeric\soperands\scan\sappear\sunquoted\sin\san\sexpression.\s\sFinally,\sthe\r\ndocumentation\sstates\sthat\sin\sorder\sto\scompare\sa\snumeric\soperand\sto\san\soperand\r\nthat\scan't\sbe\sinterpreted\sas\snumeric,\sthe\sstring\srepresentation\sfor\sthe\snumeric\r\noperand\sis\sgenerated.\s\sConsider\r\n\r\n<code><verbatim>\r\nexpr\s{{0y}\s>\s0x12}\r\n</verbatim></code>\r\n\r\n.\sSince\s<code>0x12</code>\sis\snumeric,\sand\sits\sstring\srepresentation\sis\r\n<code>18</code>,\sthe\sprevious\scommand\sshould\sproduce\sthe\ssame\sresult\sas\r\n\r\n<code><verbatim>\r\nexpr\s{{0y}\s>\s{18}}\r\n</verbatim></code>\r\n\r\n.\sHowever,\sthis\sisn't\sthe\scase.\s\sThe\sresult\sof\sthe\sfirst\scommand\sis\s<tt>1</tt>,\sand\r\nthe\sresult\sof\sthe\ssecond\sis\s<tt>0</tt>.
J login dkf
J mimetype text/plain
K ef5373e6fa0617ee02f201c6c8f41746678c5afb
U dkf
Z 8fb551485c1166ca4fd26c1654eeef98