

A small (and dangerous) C hack - dexen
http://www.jacquesmattheij.com/A+small+C+hack

======
lukesandberg
I'm not sure i understood the benefit of this over using opaque structs. If he
switched his struct definitions to being opaque he would get the appropriate
error messages that would have let him track down all the stale member
references.

Another option would have just to use two struct definitions:

in the header file he could put this: struct public { int a; int b;};

and in the implementation he could put this:

struct private { struct public pub; int c; int d;};

then when he needed so pass the public struct around externally he could just
cast the private struct to public. This would end up being pretty much
identical to the preprocessor hack but without needing to use the
preprocessor.

