I have all these Tcl / Tk version 8.1 programs that were corrupted because Tcl / Tk 8.5.10 does not handle string / number conversions correctly.
Here's the shell in Tcl and type:
% expr {01} 1
(etc.)
% expr {06} 6 % expr {07} 7
and then we get 8 ...
% expr {08} missing operator at " _@ _"
looks like an invalid octal number
But everything is getting worse. Still in the Tcl shell, try the following:
In my Tcl8.1 shell:
% format "%.0f" {08} 8
But in my new and improved Tcl8.5 shell, I get an error message:
% format "%.0f" {08} expected floating-point number but got "08" (looks like invalid octal number)
This is just plain stupid! I have all this code that works fine in Tcl7.6 and Tcl8.1, but which started to give strange random results in Tcl8.5. Only when the number 08 happened to receive or use! I spent hours trying to understand the problem. But it turns out that this is just a nasty bag of code that I use!
So, I am publishing this disclosure as a warning.
Version Tcl / Tk 8.5.10 does not handle number eight correctly. If you are expecting normal behavior from your format operators, this will not happen. Your code will fly together until it encounters a string evaluated to {08}, and the Tcl 8.5.10 interpreter will generate an error because it assumes that {08} is the octal number of a special case, regardless of all other small numbers that you used will work perfectly!
One possible solution to the problem mentioned above is to upgrade to the Tcl 8.1 shell. I confirmed that this version at least handles the format operators for the number 08 correctly. Tcl 8.5.10 shell just does not.
Russel Future
source share