[cfe-dev] [RFC] __attribute__((internal_linkage))
Steven Stewart-Gallus via cfe-dev
cfe-dev at lists.llvm.org
Fri Oct 23 09:03:12 PDT 2015
Hello,
Can I ask for some clarification?
Apparently, C++ doesn't allow to static class methods?
While in C one might write inside a header file:
static inline void mylib_foo_do_method(struct mylib_foo *foo) {
// implementation here
}
In C++ the typical style would be to write something like:
namespace mylib {
void foo::do_method(void)
{
// implementation here
}
}
Unfortunately, the C++ case then implies some linkage behaviour that
some might not want.
Apparently, one can't do things like:
namespace mylib {
static void foo::do_method(void)
{
// implementation here
}
}
Or,
namespace {
namespace mylib {
static void foo::do_method(void)
{
// implementation here
}
}
}
Also, if you wanted to an attribute to a whole namespace you should do
something like the following I think:
namespace mylib {
[[clang::internal_linkage]];
static void foo::do_method(void)
{
// implementation here
}
}
Thank you,
Steven Stewart-Gallus
More information about the cfe-dev
mailing list