No need for overly verbose typedefs in C

I used typedefs like this one for my ADTs (Abstract Data Types, also known as "opaque pointers") because I copied that syntax from somewhere:

typedef struct Node_T Node;

But you don’t need to do so, a simpler

typedef struct Node Node;

will do. C doesn’t confuse a structs name and a typedef, obviously.

Of course, you also have to rename the struct you’re referring to, from

struct Node_T
{
...

to

struct Node
{
...

Found this in the Wikipedia article about opaque pointers, https://en.wikipedia.org/wiki/Opaque_pointer.

links

social