beginthreadのスタックサイズ引数が何を意味するのか知っていると思いました。だから私の質問は:なぜこれが機能するのですか?
#include <iostream>
#include <process.h>
using namespace std;
void huge_stack(int a, int b, int c, int d)
{
int i[100000] = {0};
cout << a << b << c << d << i[12333] << endl;
}
bool done = false;
void thread(void* p)
{
huge_stack(1,2,3,4);
done = true;
}
int main()
{
_beginthread(thread, 10, nullptr);
while(!done) {}
return 0;
}
デバッグモードでビルドしていることを確認したので、呼び出しと配列は最適化されません。