Page 1 of 1

Posted: Wed Nov 14, 2007 6:48 pm
by Malcolm
I have this situation. Consider two structs that look like this ...

struct A { struct B s1; };
struct B { struct A s2; };


Compiler tosses an incomplete type error cos it obviously can't allocate memory for struct A till it knows struct B. But struct B needs struct A first.

What's the syntax that assures the compiler that struct B gets defined later, so I can initially define struct A?

Posted: Wed Nov 14, 2007 6:49 pm
by TheCatt
HAHAHAHA! C!

Good one.

Posted: Wed Nov 14, 2007 7:24 pm
by Malcolm
TheCatt wrote:HAHAHAHA! C!

Good one.
Yeah, this assignment appears to be : 1% thinking, 99% figure out how to do forward declaration in C w\ a union that uses five structs, each of which also uses the union. Both my classes have quickly devolved to suckage this semester.

Posted: Wed Nov 14, 2007 7:43 pm
by TheCatt
Just reinforces my notion that school is pretty much worthless.

Posted: Wed Nov 14, 2007 8:09 pm
by GORDON
Don't you mean ChEckers?

Posted: Thu Nov 15, 2007 3:21 am
by Malcolm
I did some digging & found a way to do it w\ about 10 header files in preprocessor statements. So, in preliminary testing, it works.

Posted: Thu Nov 15, 2007 3:23 am
by Malcolm
TheCatt wrote:Just reinforces my notion that school is pretty much worthless.
Not to be all doom & gloom on that system (since I'm kinda in it), but you're right more than 50% of the time.