struct syntax

In Gtk+/GNOME programming I often see: 

/* Style 1 */
typedef struct _Thing Thing;
struct _Thing {
	/* stuff */

I also see:

/* Style 2 */
typedef struct {
	/* stuff */
} Thing;

It seems as if Style 2 is alot clearer, and gets rid of an unnecessary

The only application of Style 1 that I can concieve of is so that you
could hide implementation details from clients by placing the typedef in
the header and defining the struct in the corresponding .c file.
clients.  I saw this used effectively in bonobo-ui-node.

So why do I see Style 1 all over the place?  There must be something I'm

Nathan Cullen
furyu fuse net

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]