LispWorks User Guide and Reference Manual > 9 The Compiler > 9.4 Compiler control

NextPrevUpTopContentsIndex

9.4.1 Examples of compiler control

The following function, compiled with safety = 2, does not check the type of its argument because it merely reads:

(defun foo (x)
  (declare (optimize (safety 2)))
  (car x))

However the following function, also compiled with safety = 2, does check the type of its argument because it writes:

(defun set-foo (x y)
  (declare (optimize (safety 2)))
  (setf (car x) y))

As another example, interpreted code and code compiled at at low safety does not check type declarations. To make LispWorks check declarations, you need to compile your code after doing:

(declaim (optimize (safety 3) (debug 3)))
LispWorks User Guide and Reference Manual - 22 Dec 2009

NextPrevUpTopContentsIndex