Sign in to follow this  
Timptation

C++ struct declaration question

Recommended Posts

MaulingMonkey    1730
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this