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
Message #41 received at 32252 <at> debbugs.gnu.org (full text, mbox):
Helmut Eller wrote:
> With your change %x will also have quite a different meaning in C11.
Not really, as Emacs (format "%x" N) agrees with C11 printf ("%x", N) in all
values of N that are valid in both languages. In C11, negative values are not
valid, as printf ("%x", N) has undefined behavior when N is negative. So we are
discussing an area where Emacs Lisp can define behavior without introducing
incompatibilities with C11.
If we changed (format "%x" -1) to signal an error instead, that would also be
upward-compatible with C11. However, it's more useful for something like (format
"#x%x" -1) to output a string that can 'read' can scan to get -1, something
that's not true of Emacs now.
>> This seems like overkill for such a small
>> change to functionality that hardly ever matters; plus, %x, %X and %o
>> would continue to have problematic machine-dependent semantics and
>> would not be sensibly extensible to bignums.
>
> If it doesn't matter to you then why make the change/break at all?
It does matter to me, actually. I think Emacs should have sensible behavior even
in corner cases that hardly ever arise in real programs.
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.