Re: The "leading zero means octal" thing...

Liste des Groupes 
Sujet : Re: The "leading zero means octal" thing...
De : rich (at) *nospam* example.invalid (Rich)
Groupes : comp.lang.tcl
Date : 06. Jan 2025, 04:15:15
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vlfhs3$1ande$3@dont-email.me>
References : 1 2 3
User-Agent : tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.139 (x86_64))
Posting groups and followup trimmed as this is Tcl specific:

In comp.lang.tcl Kenny McCormack <gazelle@shell.xmission.com> wrote:
In article <vletuv$17djb$1@dont-email.me>, saito  <saitology9@gmail.com> wrote:
...
I can't help but think that this may be related to your post regarding
time calculation. I had left this quote in my reply:
>
There is an interesting "octal" problem left as an exercise 
>
This was exactly the exercise as well. "clock format" leaves leading
zeros in the result depending on what time it was. It is missing "string
trimleft" calls which I'd discovered after some test runs before posting.
 
It is, in fact, related to that other thread.  In fact, I had developed an
entirely different solution to that problem (very short, in fact) which had
been running fine for a few weeks until it happened to hit the dreaded "08"
and crashed.  I fixed that basically by adding code using "regsub" to
remove any leading zero before doing the calculations.
 
I'll have to take a look at "string trimleft".

The canonical Tcl way to handle decimal number strings with leading
zeros is to filter them through [scan] using the %d scan pattern.

  $ rlwrap tclsh
  % scan 08 %d
  8
  % scan 00000000000000000000008 %d
  8
  %


Date Sujet#  Auteur
4 Jan 25 * The "leading zero means octal" thing...23Kenny McCormack
4 Jan 25 +* Re: The "leading zero means octal" thing...2Janis Papanagnou
5 Jan 25 i`- Re: The "leading zero means octal" thing...1Kenny McCormack
5 Jan 25 +* Re: The "leading zero means octal" thing...2Rich
5 Jan 25 i`- Re: The "leading zero means octal" thing...1Kenny McCormack
5 Jan 25 +* Re: The "leading zero means octal" thing...5Eli the Bearded
5 Jan 25 i`* Re: The "leading zero means octal" thing...4Kenny McCormack
5 Jan 25 i `* Re: The "leading zero means octal" thing...3Kenny McCormack
5 Jan 25 i  +- 'nf' in VIM (Was: The "leading zero means octal" thing...)1Kenny McCormack
5 Jan 25 i  `- Re: The "leading zero means octal" thing...1Janis Papanagnou
5 Jan 25 +- Re: The "leading zero means octal" thing...1Joe Makowiec
5 Jan 25 +* Re: The "leading zero means octal" thing...7Luc
5 Jan 25 i`* Re: The "leading zero means octal" thing...6Rich
6 Jan 25 i `* Re: The "leading zero means octal" thing...5Luc
6 Jan 25 i  +- Re: The "leading zero means octal" thing...1Rich
6 Jan 25 i  `* Re: The "leading zero means octal" thing...3Rich
6 Jan 25 i   `* Re: The "leading zero means octal" thing...2Luc
6 Jan 25 i    `- Re: The "leading zero means octal" thing...1Rich
5 Jan 25 +* Re: The "leading zero means octal" thing...4saito
5 Jan 25 i`* Re: The "leading zero means octal" thing...3Kenny McCormack
6 Jan 25 i `* Re: The "leading zero means octal" thing...2Rich
6 Jan 25 i  `- Re: The "leading zero means octal" thing...1Kenny McCormack
6 Jan 25 `- Re: The "leading zero means octal" thing...1Eric Pozharski

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal