namespace { class A { } ; }
void foo ( A ) // _Z3fooN12_GLOBAL__N_11AE
{ ; }
the function's symbol, apparently, would refer to the name of A, which is a member of uniquely named namespace (due to this).
what is the foo's linkage.?
namespace { class A { } ; }
void foo ( A ) // _Z3fooN12_GLOBAL__N_11AE
{ ; }
the function's symbol, apparently, would refer to the name of A, which is a member of uniquely named namespace (due to this).
what is the foo's linkage.?
Copyright © 2021 Jogjafile Inc.
The function
foohas external linkage since it is global and not declaredstatic. The linkage of a function doesn't depend on the parameters.The fact that
Ahas internal linkage implies that it is not possible to callfoofrom another translation unit, since it is impossible to declarefooin the other translation unit, since there is no way to write the name of the type offoo's parameter. Any attempt to defineAin another translation unit will actually define a different type.Therefore, while the name
footechnically has external linkage, it cannot actually be referred to by other translation units.