Recently, when referring to the universal two-way linked list implemented by Linux, because typeof is not a keyword specified by standard c, other compilers except the GCC compiler may not support typeof keywords, therefore, the Linux linked list is not flexible in usage. It requires that the connector, that is, the linked list structure, be used as the first element of the user-defined struct, embedded detailed comments.
IList. h
_I_LIST_H_2012_11_23_ typedef _IList * _IList * }IList, * IList_Foreach(pList, pos) \ pos = pos = (pList)-> pos != pos = pos-> IList_Foreach_Salf(pList, temp, pos) \ pos = (pList)->_next, temp = pos-> pos != pos = temp, temp = pos-> pIList IList_Nth(pIList pList,
IList. c
#include <stdio.h> #include pList->_prev = pList->_next = pNewLink->_prev = pLink-> pNewLink->_next = pNewLink->_prev->_next = pNewLink->_next->_prev = IList_Insert(pList-> pLink->_prev->_next = pLink-> pLink->_next->_prev = pLink-> pList->_next != pList ? pList-> pList->_prev != pList ? pList-> pList->_next == count = pIList temp = (pList->_next == count ++ pLink->_next != pList ? pLink-> pLink->_prev != pList ? pLink-> pIList IList_Nth(pIList pList, pIList pLink = count = count ++ (count == pIList pTemp = index = pTemp = ((pTemp != NULL) && (pTemp != index++ pTemp = (pTemp == (- }
IListTest. c
#include <stdio.h><stdlib.h><.h> ** main( argc, * i = num = count = = (argc > = atoi(argv[= (IList *)malloc( (! -, (i = ; i < num; i ++= malloc( (! -, ->_id = i + &temp->=, temp->, &=, count, ((pStudent)link)->, ((pStudent)link)-> (