Next: , Previous: inc-pointer, Up: Pointers


inc-pointer

Syntax

— Macro: incf-pointer place &optional (offset 1) => new-pointer

Arguments and Values

place
A setf place.
new-pointer
A foreign pointer.
offset
An integer.

Description

The incf-pointer macro takes the foreign pointer from place and creates a new-pointer incremented by offset bytes and which is stored in place.

Examples

  CFFI> (defparameter *two-words* (foreign-string-alloc "Common Lisp"))
  => *TWO-WORDS*
  CFFI> (defparameter *one-word* *two-words*)
  => *ONE-WORD*
  CFFI> (incf-pointer *one-word* 7)
  => #.(SB-SYS:INT-SAP #X00600457)
  CFFI> (foreign-string-to-lisp *one-word*)
  => "Lisp"
  CFFI> (foreign-string-to-lisp *two-words*)
  => "Common Lisp"

See Also

inc-pointer
make-pointer
pointerp
null-pointer
null-pointer-p