2 ms·
When folks talk about namespaces, structs, & typedefs in C, it's to call out that `struct X` and `typedef int X;` can both exist at the same time. In other word
by codys 3y ago
When folks talk about namespaces, structs, & typedefs in C, it's to call out that `struct X` and `typedef int X;` can both exist at the same time. In other words, nothing prevents one from doing a `typedef struct X { int f; } X;` or similar, using `X` as the name in both places.
It is true that it's more correct to say "struct names have their own namespace", though I think we can infer what's actually meant here fairly easily.
- kazinator 3y ago> more correct to say "struct names have their own namespace" That is false. If we declare an "enum foo", which is not a struct, then we cannot have a "struct foo" in that scope.