chiark / gitweb /
doc/runtime.tex: Suggest asserting that a stack-allocated object tore down.
authorMark Wooding <mdw@distorted.org.uk>
Mon, 5 Aug 2019 09:22:48 +0000 (10:22 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Mon, 5 Aug 2019 09:24:31 +0000 (10:24 +0100)
As discussed, it's not an error in itself if an object refuses teardown:
that just means that you can forget about it and it's someone else's
problem now.  But if you really have to deallocate it right now, that's
not going to work.

It might be an idea to introduce a macro to say, essentially,

{ int rc = sod_teardown(OBJ); assert(!rc); }

doc/runtime.tex
lib/sod.3

index a67d994ed7c8160693c9c6f5f63cb503f73a4243..46e470ea59b12edd6ca4b15a5c2e88b0b0386ee4 100644 (file)
@@ -815,7 +815,8 @@ The following macro constructs an instance with automatic storage duration.
   The instance has automatic storage duration: pointers to it will become
   invalid when control exits the scope of the declaration.  If necessary, the
   instance should be torn down before this happens, using the
-  \descref{fun}{sod_teardown}[function].
+  \descref{fun}{sod_teardown}[function].  It may be appropriate to @|assert|
+  that the object is ready for deallocation at this time.
 \end{describe}
 
 \subsubsection{Dynamic allocation}
index b6bc6dcf86bd562b6e5545da8de3438b298c5cf0..9f95c78f25a00ff7d3eb8bb82b95b2bd361dc106 100644 (file)
--- a/lib/sod.3
+++ b/lib/sod.3
@@ -480,6 +480,9 @@ the instance should be torn down before this happens,
 using the
 .B sod_teardown
 function.
+It may be appropriate to
+.BR assert (3)
+that the object is ready for deallocation at this time.
 .PP
 The
 .B SOD_MAKE