GNU bug report logs -
#32252
[PATCH] %o and %x now format signed numbers
Previous Next
Reported by: Paul Eggert <eggert <at> cs.ucla.edu>
Date: Mon, 23 Jul 2018 19:14:02 UTC
Severity: normal
Tags: patch
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On 07/26/2018 02:56 AM, Helmut Eller wrote:
> How often does one need to print a
> time value in hex notation?
It happens every time I run Emacs, in standard code shipped with Emacs.
I discovered this while doing compatibility checking before I proposed
this change. (The code in question continues to work just fine when
binary-as-unsigned is nil.)
> format-time-string doesn't even support that.
We're talking about 'format' not 'format-time-string', and Emacs code
does apply 'format' with %x to the tricky little integers that
'current-time' returns. It's a real hassle, and this hassle is pervasive
in Emacs. Having bignums would simplify it significantly.
And this problem is not limited to times. It's also file sizes, buffer
and string sizes (currently limited to fixnums, but they shouldn't be),
glyph codes, inode numbers, device numbers, file descriptor numbers,
inotify masks, windowing parameters, and other stuff I don't even know
about. It's pervasive and is a real hassle.
By the way, the format %x compatibility checking I mentioned is partly
why I have confidence that the practical effects of this change will be
minor. Many of the problems that I thought might happen, don't in fact
happen, because people who attempt to format negative numbers with %x
have already run into portability hassles on 32- vs 64-bit platforms,
and so they have written their code so that the platform choice doesn't
matter, either by ensuring that the integer is nonnegative or by not
caring what string is generated so long as it doesn't lose information.
Code written like this (and so far, that's all the code I've found)
works just fine when 'format' %x works like it does in Common Lisp or
Scheme.
This bug report was last modified 2 years and 322 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.