I have a C code that works in the following way: the header contains a declaration for the function, say:
typedef struct MyStruct
{
int thing;
void* reserved;
} MyStruct;
void foo(MyStruct* bar);
And then, in my .c code, I have this:
typedef struct EXTENDED
{
float more_stuff;
} EXTENDED;
struct MyStructEx
{
int thing;
EXTENDED* ex;
} MyStructEx;
void foo(MyStructEx* bar)
{
...
}
This compiles fine under MSVC (with warnings telling me that the header and implementation parameters don't match) but Code::Blocks (GCC) throws an error on it. Is there a way to silence this error or at least make it a warning, or is my only option to put the extra definitions in the header as well?
I'm doing this because I'm coding a modular library in C, so sometimes the individual components require "scratch space" to work (which is the void* reserved in the header), and to avoid having a bunch of casts everywhere I'm trying to implicitly cast the general-purpose MyStruct structure to a more specialized one.
So my question is, which option should I use to change this sort of error into a warning, and/or is there a better way to achieve this? (I am required to use standard C).