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

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

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


From: Jean Louis
Subject: Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?
Date: Fri, 8 Jan 2021 04:02:35 +0300
User-agent: Mutt/2.0 (3d08634) (2020-11-07)

* Stefan Monnier <monnier@iro.umontreal.ca> [2021-01-07 18:37]:
> > What is proper way to avoid this warning in `dolist' or `dotimes':
> > rcd-db.el:841:1: Warning: Unused lexical variable ā€˜iā€™
> 
> Same as for any other place where you might declare a variable that you
> don't actually use: make sure the var's name starts with an underscore.
> This tells the compiler that you're aware of the fact the var is not
> used (but still want this variable there for some reason; e.g. in
> dotimes and dolist you don't have the choice not to put a variable
> there).
> 
> Traditionally for `dotimes`, I'd then use `_` as the variable name
> unless I really want to give a hint to the reader about what kind of
> things I'm counting like (dotimes (_column-nb ...) ...).

That also sounds like workaround around the real problem. In `dotimes'
I do use the VAR counted. It is not same as (let ((_ (execute some
program without))))



reply via email to

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