I see this warning message when compiling (gcc 4.6.3, ubuntu) the example:
struct {
} a;
int main()
{
}
warning: anonymous type with no linkage used to declare variable ‘<anonymous struct> a’ with linkage [enabled by default].
GCC does not give this warning. Only G++ does.
Adding static clears the warning:
static struct {
} a;
I couldn't figure out what it means, expecially why type
is related to linkage
. I thought linkage depends on where and how a variable is declared, but not on the type of the variable itself.