This kind of struct is used as head of linked list:
struct lista
{
struct lista* next;
struct lista* prev;
};
When next and prev both points to struct itself, then the list is empty. The following macro can be used for initializing the structure:
#define LISTA_INIT_EMPTY(list) { .next = (list), .prev = (list) }
this way:
struct lista my_list = LISTA_INIT_EMPTY(&my_list);
But, is there any way to do same thing by the following way, without macro parameter?:
struct lista my_list = LISTA_INIT_EMPTY;
I tried the following, but it caused a compile error:
#define LISTA_INIT_EMPTY { .next = &.next, .prev = &.next }