I have set about learning the gtk. And when I was browsing the reference manual, I found many typedef such as “typedef struct _GtkWidget GtkWidget”. I know typedef, but I don’t quite understand the meaning of these statements. Can anybody tell me? Thanks!
Share
It is meant for hiding the implementation detail. The typedef makes
GtkWidgetan opaque data type (The actualstruct _GtkWidgetis not exposed in the headers- atleast from Gtk+3.0 onwards) The actual constituents of the struct are hidden from you when you use it in your application. You will need to use accessor functions to manipulate the constituent structure members. This way even if the implementation changes you won’t have to re-write your application.Hope this helps!