config.h evil typedef
config.h contains the line (48): {{{ #!C typedef struct ConfigHandle *ConfigHandle; }}}
This breaks when compiling a C++ module.
Changing this line to {{{ #!C typedef struct ConfigHandle_ *ConfigHandle; }}}
Solves the issue. config.c must also be updated
Comments (3)
-
Account Deleted -
reporter This is the only thing that prevents C++ modules from compiling in a stock asss (rest of asss is still C).
The reason is that the following is valid C++:
struct Test { int a; } void foo() { Test test; test.a = 5; }
"struct Test" introduces 2 symbols: "Test" and "struct Test". In C you would accomplish this by doing:
typedef struct Test Test;
(When compiling this as C++, the typedef has no effect for backwards compatibility)
But, when you do something like
typedef struct Test *Test;
There's a conflict. There already was a "Test" which is of the type "struct Test", but now you are redefining Test as "struct Test*". This will not compile.
I have grep'd the asss source code and the only place where the incomplete "struct ConfigHandle" is used instead of the typedef, is in config.c. Everything else uses the typedef "ConfigHandle". The fix could prevent compilation of non default modules that use "struct ConfigHandle*". Compiling will give an error.
-
Account Deleted - changed status to resolved
Changed ConfigHandle type names. Fixes issue 116
→ Wiki macro error: Changeset c32dc558e3de not found.
- Log in to comment
Could you elaborate on this a bit? Why is this a problem in C++? What is the fix fixing? Is the fix going to break C?