[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] XaAES modifications and clarification



Miro Kropacek wrote:
Not true. At this time, compiler is already aware of the structure declaration. That declaration statement is useless.

And furthermore, it works also for interdependent structures !

/* This is valid C */
struct A
{
	struct B* b;
};

struct B
{
	struct A* a;
};

However, I finally found the case where the forward declaration is mandatory. It is in C++, when a struct is referred to without the struct keyword. Without the forward declaration, the compiler can't know where that type come from.

// This is valid C++
struct B;

struct A
{
	B* b; // This requires the forward declaration of struct B
};

struct B
{
	A* a;
};

--
Vincent Rivière