I see occasional questions such as "what's the difference between a declaration and a definition":
What is the difference between a definition and a declaration? The distinction is important and intellectually it achieves two important things:
- It brings to the fore the difference between reference and referent
- It's how C enables separation in time of the attachment between reference and referent.
So why is a C typedef
declaration not called a typedef
definition?
Firstly, it's obviously a definition. It defines an alias. The new name is to be taken as referring to the existing thing. But it certainly binds the reference to a specific referent and is without doubt a defining statement.
Secondly, wouldn't it be called a typedec
if it were a declaration?
Thirdly, wouldn't it avoid all those confusing questions people ask when they try and make a forward declaration using a typedef?