I should first say I don't think what I want to do is possible (having read what I think are the relevant parts of the ISO C99) but here is rough idea of what I have now:
struct foo {
int x;
int *y;
};
#define FOO_INITIALIZER(name) \
{ \
.x = 1, \
.y = &(name).x, \
}
struct foo bar = FOO_INITIALIZER(bar);
This works in C99/C11 but what I really want is to drop the name parameter to the FOO_INITIALIZER macro. Is that possible?
I know this doesn't work:
#define FOO_INITIALIZER \
{ \
.x = 1, \
.y = &.x, \
}
If it is possible what section of ISO/IEC 9899:TC3 should I be looking in?