FreeRTOS列表项的结构体xLIST_ITEM的一些疑问
FreeRTOS Kernel V10.2.1在list.h中有如下定义:
struct xLIST_ITEM
{
listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
configLIST_VOLATILE TickType_t xItemValue; /*< The value being listed.In most cases this is used to sort the list in descending order. */
struct xLIST_ITEM * configLIST_VOLATILE pxNext; /*< Pointer to the next ListItem_t in the list. */
struct xLIST_ITEM * configLIST_VOLATILE pxPrevious; /*< Pointer to the previous ListItem_t in the list. */
void * pvOwner; /*< Pointer to the object (normally a TCB) that contains the list item.There is therefore a two way link between the object containing the list item and the list item itself. */
struct xLIST * configLIST_VOLATILE pxContainer; /*< Pointer to the list in which this list item is placed (if any). */
listSECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
};
其中的pxNext和pxPrevious成员类别是结构体本身的指针,有些不太明白。
在Keil里定义了一个类似的结构体:
struct node
{
int a;
struct node *p;
}test;
然后在watch里看这个变量是这样的:
看上去好别扭啊,这样没问题吗? 去看 链表 的资料 同意楼上,C语言基础复习下,链表,而且是双向链表,指针。
基础不牢,啃代码理解不到位。 嗯 看了一下链表的内容,和“不完整类型”的概念。貌似理解了:
首先,struct node 一个结构体类型的声明,并非实体。p指针是一个struct node类型的指针,也并未指向任何变量。
其次,编译器在碰到“struct node *p;”时,已经认为struct node是声明过的数据类型。
页:
[1]