[PATCH] doc: add some doc about using NULL or VOID in ptrlists

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 ptrlist.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/ptrlist.c b/ptrlist.c
index 3af0b2c5fbaa..0f0b3f6d818f 100644
--- a/ptrlist.c
+++ b/ptrlist.c
@@ -7,6 +7,18 @@
 ///
 // Pointer list manipulation
 // -------------------------
+//
+// The data structure handled here is designed to hold pointers
+// but two special cases need to be avoided or need special care:
+// * NULL is used by {PREPARE,NEXT}_PTR_LIST() to indicate the end-of-list.
+//   Thus, NULL can't be stored in lists using this API but is fine to
+//   use with FOR_EACH_PTR() and its variants.
+// * VOID is used to replace a removed pseudo 'usage'. Since phi-nodes
+//   (OP_PHI) use a list to store their operands, a VOID in a phi-node
+//   list must be ignored since it represents a removed operand. As
+//   consequence, VOIDs must never be used as phi-node operand.
+//   This is fine since phi-nodes make no sense with void values
+//   but VOID is also used for invalid types and in case of errors.
 
 #include <stdlib.h>
 #include <string.h>
-- 
2.29.2




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux