Yesterday I got a little problem with the expr function. If I use
operands with leading zero, the interpreter (tcl7.4) returns a syntax
error or the return value is indefinite. This happens only with some
special operands.
Example:
% expr 06 + 3
9
% expr 09 + 5
syntax error in expression "09 + 5"
% expr 012 * 3
30
Why does this happen ??
thnx,
Joachim
--
*********************************************************************
* Joachim Winkler < win...@gkn.de> priv.: 74080 Heilbronn *
* GKN, Abt. LRP I, 74382 Neckarwestheim *
*********************************************************************
> Why does this happen ??
According to the Tcl documentation, numbers starting with a zero are
assumed to be OCTAL. '9' is no allowed octal character.
Numbers starting with '0x' are considered hexadecimal.
--
Jeroen Hoppenbrouwers, Senior Researcher at | Stop connecting computers;
Infolab, Tilburg University, The Netherlands | start connecting people!
http://infolabwww.kub.nl:2080/infolab/people/hoppie
The leading zero is used to indicate octal encoding. You get an error for
09 because 9 is not a valid octal digit
Peter Booth