相关疑难解决方法(0)

C中的命名空间

有没有办法(ab)使用C预处理器来模拟C中的命名空间?

我正在考虑以下几点:

#define NAMESPACE name_of_ns
some_function() {
    some_other_function();
}
Run Code Online (Sandbox Code Playgroud)

这将被翻译为:

name_of_ns_some_function() {
    name_of_ns_some_other_function();
}
Run Code Online (Sandbox Code Playgroud)

c c++ namespaces c-preprocessor

51
推荐指数
6
解决办法
5万
查看次数

标签 统计

c ×1

c++ ×1

c-preprocessor ×1

namespaces ×1