Re: the foreign c-string type: what animal is that?
Kevin Rosenberg <kevin-HJRc7zDS/[email protected]> Wed, 3 Apr 2002 16:49:33 -0700 (MST)
| Newsgroups | gmane.lisp.uffi.general |
|---|---|
| Message-ID | <[email protected]> |
> That's why I have a problem with free(). Should it deallocate both? Only > the pointer? Does the pointer point to valid memory? I understand. Good questions. Typically, I believe that free deallocates only the memory pointed to by the pointer, not the pointer itself. Certainly in C, most of the time the pointers are allocated on the stack. For a low-level interface, typically it is the users responsibility to ensure it points to valid memory. For a typed foreign object, you can add a flag to indicate if the pointer has been freed. Good design questions. Kevin