GNU bug report logs - #16206
24.3; Incorrect unused variable byte-compiler warning in dotimes

Previous Next

Package: emacs;

Reported by: Christopher Wellons <wellons <at> nullprogram.com>

Date: Fri, 20 Dec 2013 21:08:01 UTC

Severity: minor

Merged with 31232, 39919, 41287

Found in versions 24.3, 26.3, 28.0.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Christopher Wellons <wellons <at> nullprogram.com>
Cc: 16206 <at> debbugs.gnu.org
Subject: bug#16206: 24.3; Incorrect unused variable byte-compiler warning in dotimes
Date: Sun, 22 Dec 2013 21:48:50 -0500
> When `lexical-binding' is t the byte-compiler issues an invalid warning
> for `dotimes' when the optional "result" form is used. For example,
> byte-compile a file with these contents.

>     ;;; -*- lexical-binding: t; -*-
>     (defun foo ()
>       (dotimes (i 1 t) i))

Indeed.  This is a known problem.  I strongly recommend you don't use
this third argument unless it makes use of `i' (which is basically the
only case where it's useful, AFAIK).

IOW use

   (defun foo ()
     (dotimes (i 1) i)
     t)


-- Stefan




This bug report was last modified 4 years and 236 days ago.

Previous Next


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