I personally don't like old C-style of struct declarations like that:
typedef struct {} NewType;
ctags makes ugly anon types of this and make the debugging difficult. Is there any reason in C++ code using typedef struct instead of simply struct, except the code is used in both C and C++?
Regards, Valentin
One major drawback of those
typedef struct tagSomethingSomething SomethingSomething;
is that, forward-declarations are not possible with the commonly used typedef'fed name.
Yes, it's a C-ism (kudos sbi) and there are c++-codebases, where it - unfortunately - (still) is common.
That's a C-ism. In C, structs and enums effectively have their one namespaces, so for
struct NewType {};
enum SomeEnum {};
you'd have to write struct NewType and enum SomeEnum to refer to.
In C++ this isn't necessary. So, Unless you write a header which needs to be parsed by a C compiler, too, you shouldn't use this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With