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

      1. <small id='90Kbe'></small><noframes id='90Kbe'>

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

        stack overflow error in C++ program(C++程序中的堆栈溢出错误)

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

          • <small id='FlxhP'></small><noframes id='FlxhP'>

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

                  本文介绍了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++程序中的堆栈溢出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to print vector#39;s data(如何打印矢量的数据)
                  Visual C++ appends 0xCC (int3) bytes at the end of functions(Visual C++ 在函数末尾附加 0xCC (int3) 字节)
                  How to use a variable inside a _T wrapper?(如何在 _T 包装器中使用变量?)
                  MSVC++ warning flags(MSVC++ 警告标志)
                  How to read file which contains uxxxx in vc++(如何在vc++中读取包含uxxxx的文件)
                  std::unordered_map very high memory usage(std::unordered_map 非常高的内存使用率)

                  • <bdo id='IPCS2'></bdo><ul id='IPCS2'></ul>
                      <legend id='IPCS2'><style id='IPCS2'><dir id='IPCS2'><q id='IPCS2'></q></dir></style></legend>

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

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

                              <tbody id='IPCS2'></tbody>