... they are just cast into void, they say.
I always though, isn't casting to void just an ugly hack that can and should be avoided with proper use of unions? But yesterday I ran into a problem that couldn't be solved that way.
I wanted to make a dynamic list that could have certain data types as its content, but I also wanted a data type, menus, that contained dynamic lists.
Now if I define the menus first, it complains that lists aren't defined.
If I define lists first, suprise objection, what's this "menu" data type you want me to store?
I wish the compiler was smart enough that when a structure includes a pointer to another type, well, we know the size of a pointer, right? It's the same no matter what it points to. The type of data structure it points to isn't relevant, and whether the type is actually defined at all need not be checked until the very end - or at least until all the other data structures are defined!
I don't believe it. I can't have mutually recursive data structures in C. Why? They work fine in Java and Ada? Don't they?
Anyway, the solution is to cast it into the void. Kiss the type-system goodbye, manage them for yourself for a little while. I make my list contain a pointer to void instead, along with an int specifying the type, of course, so I can reliably cast it back when needed.
I've become addicted to a web soap-opera. Cartoon I spotted at the new newsforge, Kevin and Kell. Ah, well. I suppose I can finish reading the archives in a day or two. Then I'll go back to programming and my other homework :-)