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: Philipp Stephani
Subject: Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?
Date: Thu, 7 Jan 2021 11:07:14 +0100

Am Do., 7. Jan. 2021 um 08:59 Uhr schrieb Jean Louis <bugs@gnu.support>:
>
> (defun db/table-id-plist (table id pg)
>   "Returns plist for table by its table_id"
>   (let* ((columns (db/table-columns table pg))
>          (sql (db/sql-by-columns table columns id))
>          (values (rcd-sql-first sql pg))
>          (values (append values nil))
>          (length (length columns))
>          (plist '()))
>     (dotimes (i length plist)
>       (setf plist (plist-put plist (intern (elt columns i)) (elt values 
> i))))))
>
>
> What is proper way to avoid this warning in `dolist' or `dotimes':
>
> rcd-db.el:841:1: Warning: Unused lexical variable ā€˜iā€™

This is https://debbugs.gnu.org/cgi/bugreport.cgi?bug=16206. tl;dr:
don't use the three-argument form of `dotimes':

(dotimes (i length)  ; no `plist' here
   ...)
plist



reply via email to

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