   syntax question
  Is there a difference between "typedef struct/class" and just "struct/class"?Or is it just a style thing.   
  In C there are two namespaces: the normal namespace and the struct namespace. In C a declaration like:struct StructName;places StructName in the struct namespace. Howevertypedef struct StructName AnotherName;puts the AnotherName type alias in the global namespace. In C you would use the typedef struct thing so that you can refer to it without typing struct in front of the name of the type everytime you refer to it. In C++ that kind of thing is pretty much pointless.   ;  In C++, they are exactly the same.  I wouldn't call it a style thing, since it doesn't change anything or really make anything more explict/implicit.   ;  typedef struct someStruct { ... } someStruct_t is used in C as a shortcut since the struct keyword is required when declaring structs. It's not generally used in C++.   ;Quote:Original post by RoboguyIn C++, they are exactly the same.  I wouldn't call it a style thing, since it doesn't change anything or really make anything more explict/implicit.They aren't exactly the same. This is a struct named S:struct S {  // data};This is an anonymous struct with a type alias named S:typedef struct {  // data} S;There are a number of differences between the two (most of which only matter if you're writing the compiler), but the big difference is that depending on the compiler, the second form can give you much more confusing error messages. Basically there's no reason to use the second form in C++.   