Thursday, November 6, 2008

Forward declaration aka prototyping

Something you have to keep in mind:

Forward declarations in header files are only possible if the header file only contains reference or pointer types of the forward declared type.

Another thing you can have a typedef to a container of custom value types (e.g. typedef RPointerArray RMyArray;) somewhere in the headerfile custom.h. Your compiler will give you errors if you only prototyp the RMyArray in another headerfile special.h even if the headerfile only uses references or pointer types of RMyArray (RMyArray& or RMyArray*)

The solution is that you have to include custom.h at the beginning of special.h.

But this was a hard way to find out. *puh*