by bradtgmurray · 11y ago · 0 comments
typedef struct Foo {
int a;
int b;
} Foo;
Foo f = (Foo) { .a = 1 }; // This will initialize b to zero. typedef struct {
int a;
int b;
} Foo;
Foo f = { .a = 1 };(Obviously, this looks like a local struct, so there's possibly no need for forward declaration. But you might have a snippet to generate this sort of thing for you. Or maybe it's just force of habit. And so on.)
Or cargo-culting.
edit: wow somebody felt threatened. I have no shame stating that I cargo-culted exactly that for a while before I actually wondered what I was doing.
Microsoft does stuff like:
typedef struct _FOO {
...
} FOO, *PFOO;
Yeah ok fine, I'll do that.