Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
偶然我有以下问题:
typedef void VOID; class Cls1 { public: VOID Clear(VOID); };
并且编译器(g++ 4.6.1)报告了
错误:'匿名'的类型不完整错误:'无效使用'VOID {aka void}'
“无效”与“无效”有什么不同吗?
好的,clang 编译器给出了一个更易读的错误:
test.cpp:14:20:错误:在 C++ 中不允许使用 typedef 为“void”定义的空参数列表 void Clear(VOID);
没有什么不同。
在 C++ 中,空参数列表是空的,而不是“void”。