Reputation: 61
I'm trying to implement XOR-linked lists on Common Lisp, but i need to get an address of a variable to perform any bitwise operations on it. Is there any way to get memory address of a variable, similar to python's id() function?
Upvotes: 5
Views: 701
Reputation: 243
If you're using Allegro Common Lisp, maybe this is what you're looking for: Escape from the Heap: Low-Level Programming in Common Lisp
Upvotes: 0
Reputation: 27444
Usually, memory management in Common Lisp is performed by some kind of Garbage Collector. Many of these algorithms move the objects in memory during a collection cycle.
So the consequencies are that you cannot count on a fixed address for each object, and for this reason no operation in the standard is provided to get the address of a Common Lisp object.
Upvotes: 7