For the simple program, forward.c:

#include <stdio.h>

typedef struct _item_st {
    int data;
    struct item_st *next;
} item_t;

int
main (int argc, char *argv[])
{
    item_t head = {0, NULL};

    head.data = 1;

    printf ("head.data: %d ptr: %p\n", head.data, (void *)head.next);
    return 0;
}

I compile with gcc 4.7.0 with:
gcc -Wall -pedantic  -std=c99 forward.c

No warning at all.  Should gcc warn about the *next pointer points to
an unknown structure?  I know it is allow by the standard, but most of
the case, it indicates some error in the code.

-- 
Qun-Ying

Reply via email to