|
From: | Stefan Monnier |
Subject: | Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'? |
Date: | Thu, 07 Jan 2021 10:35:48 -0500 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
> 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 ...) ...). Stefan
[Prev in Thread] | Current Thread | [Next in Thread] |