• <bdo id='H9QvQ'></bdo><ul id='H9QvQ'></ul>
    1. <legend id='H9QvQ'><style id='H9QvQ'><dir id='H9QvQ'><q id='H9QvQ'></q></dir></style></legend>
    2. <tfoot id='H9QvQ'></tfoot>

      <small id='H9QvQ'></small><noframes id='H9QvQ'>

      <i id='H9QvQ'><tr id='H9QvQ'><dt id='H9QvQ'><q id='H9QvQ'><span id='H9QvQ'><b id='H9QvQ'><form id='H9QvQ'><ins id='H9QvQ'></ins><ul id='H9QvQ'></ul><sub id='H9QvQ'></sub></form><legend id='H9QvQ'></legend><bdo id='H9QvQ'><pre id='H9QvQ'><center id='H9QvQ'></center></pre></bdo></b><th id='H9QvQ'></th></span></q></dt></tr></i><div id='H9QvQ'><tfoot id='H9QvQ'></tfoot><dl id='H9QvQ'><fieldset id='H9QvQ'></fieldset></dl></div>

        C++程序中的堆栈溢出错误

        时间:2023-10-06

        • <bdo id='xwvBa'></bdo><ul id='xwvBa'></ul>
            <tbody id='xwvBa'></tbody>

          <tfoot id='xwvBa'></tfoot>
          1. <i id='xwvBa'><tr id='xwvBa'><dt id='xwvBa'><q id='xwvBa'><span id='xwvBa'><b id='xwvBa'><form id='xwvBa'><ins id='xwvBa'></ins><ul id='xwvBa'></ul><sub id='xwvBa'></sub></form><legend id='xwvBa'></legend><bdo id='xwvBa'><pre id='xwvBa'><center id='xwvBa'></center></pre></bdo></b><th id='xwvBa'></th></span></q></dt></tr></i><div id='xwvBa'><tfoot id='xwvBa'></tfoot><dl id='xwvBa'><fieldset id='xwvBa'></fieldset></dl></div>

              <legend id='xwvBa'><style id='xwvBa'><dir id='xwvBa'><q id='xwvBa'></q></dir></style></legend>
                • <small id='xwvBa'></small><noframes id='xwvBa'>

                • 本文介绍了C++程序中的堆栈溢出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  所以我有这个复杂的类,我想要一个复数的二维数组,这是代码的一部分而不是全部代码

                  So i have this complex class , and i want to have an 2d array of complex numbers this is part of the code not all the code

                  class Complex {
                  public:
                      /* construction/destruction */
                      Complex(double r, double i)     { this->r = r; this->i = i; }
                      Complex()                       { r=0.0; i=0.0; }
                      ~Complex()                      { r=0.0; i=0.0; }
                          /* operations */
                      Complex operator+(Complex &c)   { return Complex( r+c.r, i+c.i ); }
                          double r, i;
                  };
                  
                  int main()
                  {
                  const int HEIGHT = 256;
                  const int WIDTH = 256;
                  Complex G[HEIGHT][WIDTH];
                  }
                  

                  所以行 Complex G[HEIGHT][WIDTH];是导致问题的线路,知道为什么吗?

                  so the line Complex G[HEIGHT][WIDTH]; is the line that causes the problem , any idea why ?

                  推荐答案

                  Visual Studio 默认为 1MB 堆栈大小,看起来像:

                  Visual studio defaults to 1MB stack size, it looks like:

                  Complex G[HEIGHT][WIDTH];
                  

                  大约 1MB,您可以使用 /F 并且文档说(强调我的):

                  will be just about 1MB, you can modify this using /F and the document says (emphasis mine):

                  如果没有此选项,堆栈大小默认为 1 MB.number 参数可以是十进制或 C 语言表示法.该参数的范围可以从 1 到链接器接受的最大堆栈大小.链接器将指定的值向上舍入到最接近的 4 个字节./F 和数字之间的空格是可选的.

                  Without this option the stack size defaults to 1 MB. The number argument can be in decimal or C-language notation. The argument can range from 1 to the maximum stack size accepted by the linker. The linker rounds up the specified value to the nearest 4 bytes. The space between /F and numberis optional.

                  最明显的替代方法是通过new 或std::vector.

                  The most obvious alternative would be to use dynamic memory allocation via new or std::vector.

                  Visual Studio 据我所知实际上有 较小的默认堆栈大小之一:

                  Visual Studio as far as I know actually has one of the smaller default stack sizes:

                  platform    default size       
                  =====================================
                  SunOS/Solaris  8192K bytes
                  Linux          8192K bytes
                  Windows        1024K bytes
                  cygwin         2048K bytes
                  Mac OS X       8192K bytes
                  

                  这篇关于C++程序中的堆栈溢出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:std::unordered_map 非常高的内存使用率 下一篇:如何在vc++中读取包含uxxxx的文件

                  相关文章

                  最新文章

                  <tfoot id='1lpv0'></tfoot>

                    • <bdo id='1lpv0'></bdo><ul id='1lpv0'></ul>

                    <i id='1lpv0'><tr id='1lpv0'><dt id='1lpv0'><q id='1lpv0'><span id='1lpv0'><b id='1lpv0'><form id='1lpv0'><ins id='1lpv0'></ins><ul id='1lpv0'></ul><sub id='1lpv0'></sub></form><legend id='1lpv0'></legend><bdo id='1lpv0'><pre id='1lpv0'><center id='1lpv0'></center></pre></bdo></b><th id='1lpv0'></th></span></q></dt></tr></i><div id='1lpv0'><tfoot id='1lpv0'></tfoot><dl id='1lpv0'><fieldset id='1lpv0'></fieldset></dl></div>
                    <legend id='1lpv0'><style id='1lpv0'><dir id='1lpv0'><q id='1lpv0'></q></dir></style></legend>

                      <small id='1lpv0'></small><noframes id='1lpv0'>