I am curious about the motivation for this behavior in C. Was it intentional or an accident?
struct tpoint // tpoint is not a type name
{
int x, y;
};
typedef struct tpoint Point; // point is a type name.
I want to know why Ritchie or the standard committee chose this behaviour.
It's a namespacing thing. This way, I can have struct a
, enum a
, union a
, and none of them are ambiguous. It helps when designing frameworks which may have similar type names, but it can get confusing fast.
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