On this line ((pointerp (first args)) (mem-aref (%vector-float-to-c-array (first args)) :float (second args)))
in the below code the (second args)
compiles with the warning This is not a number NIL
. The function works but how do I get rid of this warning in an implimentation independent way using just Lisp. The solution would need to be really fast. The code took a long time to get to right and runs great so I can't really change the operation of it. the functions you don't recognize don't really matter as far getting warning to go away...Thank you in advance for any help.
(defun vector-float (&rest args)
(cond ((eq (first args) nil) (return-from vector-float (%vector-float)))
((listp (first args))
(c-arr-to-vector-float (first args)))
((symbolp (cadr args)) (%vector-float-size (first args)))
((pointerp (first args)) (mem-aref (%vector-float-to-c-array (first args)) :float (second args)))
(t nil)))
If
(second args)
isNIL
then eitherargs
has nosecond
or itssecond
isNIL
. However, the third argument tomem-aref
must be a number since it is an index. Therein lies the problem.If in your program
(second args)
is allowed to beNIL
(or to not exist), then you'll have to test for that possibility and avoid passingNIL
tomem-aref
(maybe by leaving out that optional argument). If(second args)
is not allowed to beNIL
, then the bug is somewhere else in your program.E.g. (untested),