When do you worry about stack size?

前端 未结 19 1166
难免孤独
难免孤独 2020-12-10 12:41

When you are programming in a language that allows you to use automatic allocation for very large objects, when and how do you worry about stack size? Are there any rules o

19条回答
  •  独厮守ぢ
    2020-12-10 13:35

    I never worry about it. If there is a stack overflow, I will soon know about it. Also, in C++ it is actually very hard to create very large objects on the stack. About the only way of doing it is:

    struct S {
       char big[1000000];
    };
    

    but use of std::string or std::vector makes that problem go away.

提交回复
热议问题