GNU bug report logs - #17475
24.3.91; bug of byte-optimize-zerop

Previous Next

Package: emacs;

Reported by: Shigeru Fukaya <shigeru.fukaya <at> gmail.com>

Date: Mon, 12 May 2014 15:12:02 UTC

Severity: minor

Found in version 24.3.91

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Shigeru Fukaya <shigeru.fukaya <at> gmail.com>
To: 17475 <at> debbugs.gnu.org
Subject: bug#17475: 24.3.91; bug of byte-optimize-zerop
Date: Tue, 13 May 2014 00:11:11 +0900
`byte-optimize-zerop' is badly implemented.  Even when
`byte-compile-delete-errors' is non-nil, bute-compiled code may
signal an error.
(= FORM 0) and (zerop FORM) are functionally equal, besides, the
former is better when byte-compiled.

The following is the poor alternative.
I can't make a smart code without creating a new function.

(defun byte-optimize-zerop (form)
  (cond ((numberp (nth 1 form))
         (eval form))
        (byte-compile-delete-errors
         `(and (member ,(nth 1 form) (quote 0 0.0))) t)
        ((list '= (nth 1 form) 0))))

-- Shigeru




This bug report was last modified 10 years and 357 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.