[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#16206: 24.3; Incorrect unused variable byte-compiler warning in doti
From: |
Michael Heerdegen |
Subject: |
bug#16206: 24.3; Incorrect unused variable byte-compiler warning in dotimes |
Date: |
Wed, 25 Apr 2018 02:11:38 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Stefan Monnier <monnier@IRO.UMontreal.CA> writes:
> > -the return value (nil if RESULT is omitted).
> > +the return value (nil if RESULT is omitted). Note that RESULT
> > +should not be used unless it makes use of VAR.
>
> I would drop the "unless it makes use of VAR".
Yes.
For example,
#+begin_src emacs-lisp
(let ((count 10) (result 0))
(dotimes (i count result)
(print i)
(setq result (+ result i))))
#+end_src
produces the warning - but doesn't RESULT "make use of the VAR"?
With the suggested patch, we would have a strange macro argument, using
it can produce strange compiler warnings, and we would have an obscure
description how these should be avoided. It has to stop.
Michael.