|
|
|
|
|
by s28l
1323 days ago
|
|
I don't think that's true. Neither C nor C++ would allow you to invoke a function with an incomplete type, regardless of whether it is a `struct` or an `enum`, so there's no ABI issues with forward declaring them, but you wouldn't be able to define or invoke a function that takes an incomplete type argument by value. struct A;
enum B; // as you pointed out, not allowed by the C++ standard
// fine to declare, define, and invoke
void fooA(struct A*);
void fooB(enum B*);
// ok to forward declare, but you can't call them
void barA(struct A);
void barB(enum B);
|
|
Enums in GCC do always default to int or unsigned int, unless -fshot-enums is used which is ABI breaking.
Probably I was misremembering this combination of the int ABI and the forward declaring extension.