Suppress warning for function arguments not used i

2019-02-17 15:46发布

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条回答
地球回转人心会变
2楼-- · 2019-02-17 15:51

See the Common Lisp Hyperspec: Declaration IGNORE, IGNORABLE

(defun true (X Y)
  (declare (ignore y))
  X)
查看更多
登录 后发表回答