[PATCH 21/22] list.3: BUGS: Note LIST_FOREACH() limitations

Alejandro Colomar
2020-10-20T14:23:45Z

man3/list.3 | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/man3/list.3 b/man3/list.3
index bb64fff92..4aec14cc8 100644
--- a/man3/list.3
+++ b/man3/list.3
@@ -261,6 +261,20 @@ Not in POSIX.1, POSIX.1-2001 or POSIX.1-2008.
Present on the BSDs
(LIST macros first appeared in 4.4BSD).
.SH BUGS
+The macro
+.BR LIST_FOREACH ()
+doesn't allow
+.I var
+to be removed or freed within the loop,
+as it would interfere with the traversal.
+The macro
+.BR LIST_FOREACH_SAFE (),
+which is not present in glibc,
+solves this bug by
+allowing to both remove
+.I var
+as well as free it from within the loop safely
+without interfering with the traversal.
.SH EXAMPLES
.EX
#include <stddef.h>
--
2.28.0