Is it possible to declare a function with C linkage without it having external linkage? When trying to compile
extern "C" static void f() {}
I get
f.cc:1: error: invalid use of 'static' in linkage specification
which makes sense, in a way. In namespace { extern "C" void f() {} }
, the extern
specifier seems to override the anonymous namespace's restricted scope.
If this is not possible, does it matter when passing a function pointer to C?