【发布时间】:2019-11-04 22:29:33
【问题描述】:
我猜/希望模块名称不会与例如冲突。变量的名称。有人可以确认这一点,或许可以参考(即将发布的)标准中的合适部分吗?
文件:a_module.cc
export module a_module;
export int add(int a, int b) { return a + b; }
// Question-1: Is using 'a_module' below as variable name allowed, or does
// the 'export module a_module' above prevent us from using that name?
int a_module = 11;
文件:main.cc
import a_module;
// Question-2: Is using 'a_module' below as variable name fine, or does the
// 'import a_module' above prevent us from using that name?
int a_module = 42;
int main() { return add(1, 2); }
【问题讨论】:
标签: c++ c++20 c++-modules