Skip to content
Tcl Source Code History Of Ticket af4780b0b5245f03
Login

History Of Ticket af4780b0b5245f03

Artifacts Associated With Ticket af4780b0b5245f03

  1. Ticket change [8b0c235ce2] (rid 245051) by oehhar on 2025-09-03 11:37:26:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-wiki"
    4. comment initialized to:
      On clt, there was the following proposal by Marc Summerfield on the "#" specifier of the format command man page:
      
      <verbatim>
      I suggest replacing:
      
          For d conversions, 0d there is no effect unless the 0 specifier is used
          as well: In that case, 0d will be added to the beginning. 
      
      with:
      
          For d conversions, 0d has no effect; whereas both #d and #0d produce an
          0d prefix.
      
      Might also be worth adding:
      
          Note that width includes any prefix. For example "%06d" shows
          at least 6 digits, but "%#06d" shows at least 4 digits.
      
      Evidence:
      
      Main console display active (Tcl9.0.2 / Tk9.0.2)
      (mark) 61 % format "%d %0d %06d %#d %#0d %#06d" 12 13 14 15 16 17
      12 13 000014 0d15 0d16 0d0017
      </verbatim>
      
    5. foundin initialized to: "main"
    6. is_private initialized to: "0"
    7. login: "oehhar"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "0f366eb3e9e2fcab52b8ebacd197db9047186a5f"
    10. resolution initialized to: "None"
    11. severity initialized to: "Minor"
    12. status initialized to: "Open"
    13. submitter initialized to: "oehhar"
    14. subsystem initialized to: "16. Commands A-H"
    15. title initialized to: "Improve format #d documentation"
    16. type initialized to: "RFE"
  2. Ticket change [cbadab6bcf] (rid 245052) by oehhar on 2025-09-03 11:38:54:

    1. comment changed to:
      On clt, there was the following proposal by Marc Summerfield on the "#" specifier of the format command man page:
      
      <verbatim>
      I suggest replacing:
      
          For d conversions, 0d there is no effect unless the 0 specifier is used
          as well: In that case, 0d will be added to the beginning. 
      
      with:
      
          For d conversions, 0d has no effect; whereas both #d and #0d produce an
          0d prefix.
      
      Might also be worth adding:
      
          Note that width includes any prefix. For example "%06d" shows
          at least 6 digits, but "%#06d" shows at least 4 digits.
      
      Evidence:
      
      Main console display active (Tcl9.0.2 / Tk9.0.2)
      (mark) 61 % format "%d %0d %06d %#d %#0d %#06d" 12 13 14 15 16 17
      12 13 000014 0d15 0d16 0d0017
      </verbatim>
      
      Remark, that there is a change compared to Tcl 8.6.
      Tcl 8.6 returned:
      
      <verbatim>
      format "%d %0d %06d %#d %#0d %#06d" 12 13 14 15 16 17
      12 13 000014 15 16 000017
      </verbatim>
      
    2. login: "oehhar"
    3. mimetype: "text/plain"
  3. Ticket change [dd0d6dfbeb] (rid 245053) by jan.nijtmans on 2025-09-03 13:50:52:

    1. icomment:
      This was specified in TIP #476 as follows:
      
      >Adapt the %#d modifier. The prefix "0d" is only produced when there is a width field and the formatted number is not 0, i.e. when there is possible confusion with an octal number. Since in Tcl 9.0 octal numbers with "0" prefix will be gone, "#" will not produce the decimal prefix any more.
      
      The idea was, for Tcl 8.7, to keep maximum compatibility with 8.6. For Tcl 9.0, the idea was to never output "0d" any more, for maximum compatibility with "C".  Apparently, the behavior in Tcl 9.0 was never adapted as described in this TIP; it's still the same as in (never released) 8.7.
      
      Since 9.0 is released now, I think we should keep it as it is now....
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
  4. Ticket change [f3c0b05a83] (rid 245058) by jan.nijtmans on 2025-09-03 21:41:03:

    1. icomment:
      For completeness:
      
      * A field with specifier produces a 0d prefix as well
      
      * If the value is 0, a 0d prefix is never added.
      
      So, we get something like:
      <pre>
      For d conversions, there is only effect in combination
      with zero-padding or a field width: In that case, 0d
      will be added to the beginning of the result unless it is zero.
      </pre>
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-markdown"
  5. Ticket change [72bff7c74d] (rid 245115) by oehhar on 2025-09-04 14:11:57:

    1. icomment:
      For me, it would be ok to revert this.
      It is really a hack (for 8.7) and breaks 8.6 compatibility for no benefit.
      
      Thanks,
      Harald
      
    2. login: "oehhar"
    3. mimetype: "text/plain"
    4. username: "oehhar"
  6. Ticket change [4c5dd20f56] (rid 245116) by jan.nijtmans on 2025-09-04 14:46:13:

    1. icomment:
      The benefit is being able to produce formatted integers with "0d", in the same way we can produce hex integers with "0x" prefix.
      
      In TIP #472:
      
      > Also extend format command '#' flag to produce the appropriate "0d" for the "%#d" conversion
      
      I realized that, since the C language doesn't implement the '#' flags for %d, this would be a potential incompatibility. Therefore, in TIP #476 I proposed to only let it have effect in combination with 0-padding or a width specifier: that's the only 2 situations the "0d" prefix really makes sense.
      
      Since Tcl 9.0 is the first Tcl version which understand 0d-prefixed integers, no-one uses this yet. But since the "0d" prefix is advertised as one of the features of Tcl 9, I wounldn't just remove this 'feature'.
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
  7. Ticket change [dde4b7df36] (rid 245137) by oehhar on 2025-09-04 16:19:07:

    1. icomment:
      Great! Copied the relevant text from TIP 472 to the migration hints: [https://core.tcl-lang.org/tcl/wdiff?id=34d108ee8e05717e].
      
      I don't see, that it only works with zero padding and it is not intended as such. The TIP example is:
      
      <verbatim>
      % format "%#d" 128
      0d128
      </verbatim>
      
      This works for me.
      
      Thanks for all,
      Harald
      
    2. login: "oehhar"
    3. mimetype: "text/x-fossil-wiki"
    4. username: "oehhar"
  8. Ticket change [f5a972afd2] (rid 245142) by jan.nijtmans on 2025-09-04 16:56:55:

    1. assignee changed to: "jan.nijtmans"
    2. closedate changed to: "2460923.20619501"
    3. closer changed to: "jan.nijtmans"
    4. icomment:
      Harald, you are right!
      
      So, documentation updated as well (again), using the same wording as for '0x'
      
      Closing
      
    5. login: "jan.nijtmans"
    6. mimetype: "text/x-fossil-wiki"
    7. resolution changed to: "Fixed"
    8. status changed to: "Closed"