Part Five - Stack Configuration

Nested C++ Recursion - Introduction (Main Article Page)

Part Four - Building A Visual Studio C++ Project showed how to build Visual Studio C++ solutions with the code files available at the GitHub resource. Here, we'll see how to configure the stack for the software we'll build with those code files.

After creating a Visual Studio solution based on the source code files, right-click the project in Solution Explorer, and drill down to Properties, as shown in this screenshot:

This will open the Property Pages window. At the left, drill down to

          Configuration Properties -> Linker -> System

as shown here:



Visual Studio defaults new projects to a Stack Reserve Size value of 1 meg, but this project needs much more. For the development of this solution on the Windows 10 laptop, the Stack Reserve Size option has a setting of 6000000 (units), as shown:


Different devices might need different Stack Reserve Size values for this solution, but without some sort of configuration here, a probable stack overflow will crash the application. We can expect the integer vector-based solutions to need more stack resources, compared to the array-based solutions. In the hardware used to develop the software described in this article, the array-based solutions needed 6000000 (units) of stack resources, and the vector-based solutions needed 7000000 (units) of stack resources. Different hardware situations might involve different stack resource requirements.

Here, we saw how to configure the stack for the nested C++ recursive solution engineering for the Euler 44 Pentagonal Numbers problem. Part Six - An Euler 44 Nested Recursive Solution will explore an actual nested C++ recursion solution to the Euler 44 problem.