help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FW: How to avoid compiler warning `unused lexical variable' for `dol


From: Stefan Monnier
Subject: Re: FW: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?
Date: Thu, 07 Jan 2021 21:26:12 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> What we talk is return value in third place of `(dolist (first second
> third))' and it is strange that if return value is asked from `dolist'
> that then the `first' one is warned about.

The third arg is different from "the expression after `dotimes`" in one
important respect: the third arg can refer to the iteration variable
which will contain the "last" value:

    (dotimes (i 10 i) nil)

will return 10.
So the warning comes when you use that 3rd arg but without referring to
the iteration variable: in that case, you could have put the result
*after* `dotimes` rather than putting it in the 3rd arg.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]