Ar an séiú lá de mí Márta, scríobh Jerry James:
APPROVE COMMIT 21.5
On Tue, Mar 5, 2013 at 8:57 PM, Stephen J. Turnbull <stephen(a)xemacs.org>
> wrote: Great! BTW, kudos to whoever designed the make_integer
> vs. make_fixnum API. It's perfect for this kind of thing, looks nice
> either way.
I think that was Aidan. Aidan, take a bow! :-)
Nope, that particular glory is all yours!
> It may be just me :-), but I think it reads a lot better.
> Thanks for putting up with my crankiness!
Not at all. I like this better than the original patch, too. That's
what code review is for, eh?
I have committed the second version of the patch.
I proposed something similar to your patch back in ’08, and noticed an issue
then that’s still relevant. Cf. the following sample code:
(let ((big-file "/Users/aidan/Desktop/VMware Images/Windows XP—Cygwin, dev
tools/Windows XP Professional.vmdk"))
(shell-command-to-string (concat "ls -l " (shell-quote-argument big-file)))
;; Access the size field in the file-attributes list:
(nth 7 (file-attributes big-file))))
=> "-rwxrwxrwx＠ 1 aidan wheel 6427770880 28 Dez 2008
/Users/aidan/Desktop/VMware Images/Windows XP—Cygwin, dev tools/Windows XP
The issue is that make_bignum (which is what make_integer breaks down to if
the value doesn’t fit in a fixnum) truncates long longs. You document this
. Something like:
#define make_integer(x) \
(NUMBER_FITS_IN_A_FIXNUM (x) ? make_fixnum (x) : \
(sizeof (x) > SIZEOF_LONG ? make_bignum_long_long (x) : make_bignum (x)))
would involve no extra run-time calculation for non-off_t or non-size_t
values, though it would involve writing a make_bignum_long_long function.
‘Liston operated so fast that he once accidentally amputated an assistant’s
fingers along with a patient’s leg, […] The patient and the assistant both
died of sepsis, and a spectator reportedly died of shock, resulting in the
only known procedure with a 300% mortality.’ (Atul Gawande, NEJM, 2012)
XEmacs-Patches mailing list