Microsoft Visual Studio Professional 2015版本14.0.25431.01更新3在編譯code below時發出錯誤。對我來說看起來像一個bug。VC Bug?編譯器無法計數__VA_ARGS__'參數
謝謝。
#include <iostream>
#define A(a, b, c, ...) #__VA_ARGS__
#define B(...) A(__VA_ARGS__)
int main()
{
// warning C4003: not enough actual parameters for macro 'A'
// error C2059: syntax error: ';'
std::cout << B(1, 2, 3, 4); // should print '4'
return 0;
}
[MSVC不能正確展開'__VA_ARGS__'](http://stackoverflow.com/questions/5134523/msvc-doesnt-expand-va-args-correctly) – cpplearner
@cpplearner謝謝。 – ZDF