What's the point of convention for _StructName in C?
After reading some source from the GTK + library, I came across what I think is a rather strange piece of code:
typedef struct _GtkWidgetClass GtkWidgetClass;
...
struct _GtkWidgetClass
{
...
};
What I don't understand about this code is why it is not written like this:
typedef struct
{
...
} GtkWidgetClass;
I feel like I'm missing something ...
If someone can fill me in on why exactly GTK (or, for that matter, any other code) is written this way, it would be very helpful.
Thank you in advance
source to share
From a strict coding point of view, it doesn't make any sense. However, in header files, it can serve as an interface definition type that renders the "public" GTK + interface. By the way, this style follows other GNU libraries.
Anyway, I think we can safely say that with modern C compilers and tools, it doesn't really make much sense, but GTK + is not really a new library, so it may contain some archaic conventions.
source to share