ID Number: Q50732
5.10 6.00 6.00a 6.00ax 7.00 | 5.10 6.00 6.00a
MS-DOS | OS/2
Summary:
Code that assigns a value to a nonexistent structure compiles without
warning or error in Microsoft C and QuickC. This is correct behavior.
Note that dereferencing a pointer to an undefined structure, or
attempting to use a field, will produce errors. In general, you are
allowed to make a reference to an undefined struct as long as the
operation doesn't need to know the size of that struct or the names of
its fields. This method of declaration is commonly used in linked
lists.
More Information:
void main (void)
{
struct non_existant *ptr; // legal
struct x{
struct x *previous; // legal, note that struct x is
struct x *next; // not yet defined
};
.
.
.
.
}
Additional reference words: 5.10 6.00 6.00a 6.00ax 7.00