S
Szabolcs Borsanyi
Dear all,
I'd like to define a macro that expands to a struct-or-union-specifier.
Inside of this struct there shall be a named structure. Alas, the struct
tag inside the other unnamed structure has the scope of the translation unit,
is that right?
So how could I possibly modify the following simplified code to bring it
back within the language constraints.
#define type_template(typename) \
struct { int a; struct a { struct a *p; typename x; } b; }
int main()
{
type_template(double) A;
type_template(double) B;
type_template(int*) C;
return 0;
}
I have one idea, but that will break if I erase the newline after A;
Thanks,
Szabolcs
I'd like to define a macro that expands to a struct-or-union-specifier.
Inside of this struct there shall be a named structure. Alas, the struct
tag inside the other unnamed structure has the scope of the translation unit,
is that right?
So how could I possibly modify the following simplified code to bring it
back within the language constraints.
#define type_template(typename) \
struct { int a; struct a { struct a *p; typename x; } b; }
int main()
{
type_template(double) A;
type_template(double) B;
type_template(int*) C;
return 0;
}
I have one idea, but that will break if I erase the newline after A;
Thanks,
Szabolcs