After reading
I wonder if the following workaround would work and what can be its deepest implications at compiler-level.
// foo.h
typedef struct foo
{
int i;
#ifdef __cplusplus
foo(int _i) : i(_i) {};
#endif
} foo;
// bar.c
#include "foo.h"
foo bar;
bar.i = 1;
// bar.cpp
#include "foo.h"
foo bar(2);
In my view is a great trick to leverage "struct polymorphism", being able to keep portability with C legacy code, but I have the feeling that in some way I'm now working with two different types.