aboutsummaryrefslogtreecommitdiff
path: root/doc/language/function/cpsc-function-free.7.md
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-27 13:30:54 +0000
committer_ov4 <ov4@ov4.org>2026-10-27 13:30:54 +0000
commit24f410430b33aaf1f288b83ea37e18fa959e9d3e (patch)
tree1f10b4ad2fae28a54064be270de70454343a4d64 /doc/language/function/cpsc-function-free.7.md
parent0dd0b0908300eee08a06ee51d9eb48b85fd97d74 (diff)
docs(memory): describe standard-library allocation and explicit imports
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'doc/language/function/cpsc-function-free.7.md')
-rw-r--r--doc/language/function/cpsc-function-free.7.md4
1 files changed, 3 insertions, 1 deletions
diff --git a/doc/language/function/cpsc-function-free.7.md b/doc/language/function/cpsc-function-free.7.md
index 366b317..ef4b72e 100644
--- a/doc/language/function/cpsc-function-free.7.md
+++ b/doc/language/function/cpsc-function-free.7.md
@@ -12,12 +12,14 @@ FREE(pointer)
# DESCRIPTION
-FREE is a compiler extension. Its argument and return type are C `void*`. Explicitly cast other pointer types to a `void*` alias before passing them. A null pointer is accepted and returned. A non-null pointer must be the start of an active explicit MALLOC, REALLOC or keyword NEW allocation; internal STRING/ARRAY storage, stack addresses, interior addresses and already released allocations are rejected with a source-line diagnostic on stderr and an anonymous exception.
+FREE is an extension provided by the memory.cps standard-library unit. Its argument and return type are C `void*`. Explicitly cast other pointer types to a `void*` alias before passing them. A null pointer is accepted and returned. A non-null pointer must be the start of an active explicit MALLOC, REALLOC or keyword NEW allocation; internal STRING/ARRAY storage, stack addresses, interior addresses and already released allocations are rejected with a source-line diagnostic on stderr and an anonymous exception.
FREE returns its input address after releasing the allocation. It does not clear the caller's variable. The returned address and all aliases are invalid for memory access. Calling FREE again on that address throws unless a subsequent allocation has reused the address. Tracking cannot distinguish stale aliases once an address is reused.
The result can be discarded with a standalone call. No user destructor is called. Use keyword DELETE on a class object to destroy it and its fields before releasing its allocation.
+The default std.cps imports memory.cps automatically. With **-no-std**, explicitly INCLUDE memory.cps and pass it as a compiler input; its INCLUDE_OBJ links memory.o for native output and execution. Manual linking of saved IR requires the matching library objects and C++ runtime.
+
# EXAMPLE
```text