Suppress warning for function arguments not used in LISP

白昼怎懂夜的黑 提交于 2019-12-01 03:30:47

问题


In lisp, I need to define a set of functions, all with the same number of arguments. However, the functions may or may not use all the arguments, leading to a spur of warning messages. For example:

(defun true (X Y) X)
[...]
; caught STYLE-WARNING:
;   The variable Y is defined but never used.

Is there a way to warn the compiler that is was intended?


回答1:


See the Common Lisp Hyperspec: Declaration IGNORE, IGNORABLE

(defun true (X Y)
  (declare (ignore y))
  X)


来源:https://stackoverflow.com/questions/22231465/suppress-warning-for-function-arguments-not-used-in-lisp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!