Reputation: 3358
Does this mean anything:
typedef struct spBone spBone;
struct spBone {
...
}
I found the above in a header of a .c file. What could be the side-purpose of assigning a non-alternative name to a struct?
Upvotes: 0
Views: 1175
Reputation: 33931
First, remember that C and C++ are different languages. C++ is rooted in C, but went in some very different directions. This is one of them.
When declaring or defining a variable of type struct
in C, one must always use the keyword struct
. For example
struct spBone myspBone;
is required. Why this is required likely made a lot of sense back in the 1970s.
However, the programmer is establishing spBone
as an alias to struct spBone
so that they can use the alias and
spBone myspBone;
as you can in C++.
Upvotes: 3