• Advertisement
Sign in to follow this  

C++ struct declaration question

This topic is 2893 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
In modern C++, basically none. I would prefer the former. You won't be able to have a custom constructor or destructor with the latter.

typedef struct { ... } structName; is an old practice from the days of C, where you would always have to type out "struct structName" instead of just "structName" for every variable and parameter unless you used a typedef. But that's not required in C++.

Share this post


Link to post
Share on other sites
Thanks for the quick reply! That's pretty much what I had assumed, that it was an old C leftover. I appreciate the "where it comes from" explanation.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement