这是这篇文章的副本:Brace Enclosed Initializer List As Function Argument,尽管我正在寻找仅使用 C 中可用方法的解决方案。我正在使用 Windows 8 编译器。
基本上,我想做这样的事情:
HANDLE hThread1 = CreateThread(...);
HANDLE hThread2 = CreateThread(...);
HANDLE hThread3 = CreateThread(...);
...
WaitForMultipleObjects( 3, {hThread1,hThread2,hThread3}, FALSE, INFINITE );
而不是这个:
HANDLE hThread[3];
hThread[0] = CreateThread(...);
hThread[1] = CreateThread(...);
hThread[2] = CreateThread(...);
...
WaitForMultipleObjects( 3, hThread, FALSE, INFINITE );
foo(arg1, arg2, {arg3_1, arg3_2});