[Openmcl-devel] odd behaviour of #_malloc and length?

rs stoye at stoye.com
Thu Jan 12 07:52:23 PST 2006


i know there is ccl::malloc, but...
when i use length on a local variable containing a string in a  
#_malloc call it errors out with:
   value NIL is not of the expected type (UNSIGNED-BYTE 32).

(let* ((a "a string")
           (mem (#_malloc (+ (length a) 1))))
   (format t "mem is ~s" mem)
   (when mem
     (#_free mem)))

-> value NIL is not of the expected type (UNSIGNED-BYTE 32).

all of the following forms are ok (no error)

(let* ((mem (#_malloc (+ (length "a string") 1))))

(let* ((mem (#_malloc (+ (length "a string") 1))))

(let* ((a "a string")
           (mem (#_malloc (+ (array-total-size a) 1))))

(let* ((a "a string")
        (mem (#_malloc (+ (ccl::uv-size a) 1))))

(let* ((a '(1 2 3 4))
           (mem (#_malloc (+ (length a) 1))))

(let* ((a "a string")
           (len (+ (length a) 1))
           (mem (#_malloc len)))






More information about the Openmcl-devel mailing list