Bonjour,
j'ai un problème d'initialisation de structure avec une macro, j'ai une macro block_list_init_head qui initialise ma structure block_list_head :
ensuite je retourne un pointeur sur head.pool qui est un pointeur sur une structure de type block_pool et j'initialise ma structure head avec la macro.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 // The block list header structure struct block_list_head { struct linked_list_head head; ///< Block list head are linked list head struct block_pool * pool; ///< A pointer to the Block Pool unsigned int free; ///< Free size int he Block Pool }; /// Initialise a block list head /** * \param head A pointer to the head of a list. * \param pool A pointer to the block pool */ #define block_list_init_head(head,pool) linked_list_init_head((struct block_list_head *)(head)); ((struct block_list_head *)(head))->pool = pool; ((struct block_list_head *)(head))->free = 0
mais le compilateur me dis que pool n'est pas un membre de 'linked_list_head' mais dans ma macro je lui dis bien que pool est un membre de 'block_list_head' donc je ne comprend pas l'erreur.
quel pourrais etre l'erreur dans mon code ? merci d'avance car la je bloque pas mal.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 static struct block_list_head head; head.pool = block_pool_create(sizeof(struct block_list_head),sizeof(struct block_list_head)* 32,1,0); block_list_init_head(&head,head.pool); // Initialize the linked list of block pool
erreur du compilo :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 2>d:\svn\age\tests\blocklist\blocklist.c(22) : error C2039: 'pool' : is not a member of 'linked_list_head' 2> d:\svn\age\common\include\linked_list.h(33) : see declaration of 'linked_list_head'
Partager