{"id":6856,"date":"2024-02-05T12:42:26","date_gmt":"2024-02-05T18:42:26","guid":{"rendered":"https:\/\/www.logikalsolutions.com\/wordpress\/?p=6856"},"modified":"2024-02-05T12:42:27","modified_gmt":"2024-02-05T18:42:27","slug":"heap","status":"publish","type":"post","link":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/heap\/","title":{"rendered":"C++ \u2013 Defaults and Deletes \u2013 Pt. 2"},"content":{"rendered":"\n<p>Before we go much further with this discussion on Defaults and Deletes, I need you to read the section titled <em>Near Heap<\/em> in <a href=\"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/smart-pointers\/\">this blog post<\/a>. It&#8217;s a short read with pictures. Then you need to go thank the fools . . . err . . . &#8220;learned academics&#8221;, cough cough, who re-purposed the word heap to be a binary tree data structure.<\/p>\n\n\n\n<p>To understand why things are the way they are, I need you to understand some things you would have learned had you actually taken an Assembly Language class. I also need you to, at least temporarily, ignore what the . . . &#8220;learned academics&#8221; used the name heap for. Adding insults to your injuries you will find many on-line experts and official C++ documentation sites using the phrases <em>stack<\/em> for near heap and <em>heap<\/em> for far heap.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">PSECT and DSECT<\/h2>\n\n\n\n<p>On real computers with real operating systems when you LINK objects into an executable you can add a \/MAP (syntax varies) qualifier to the LINK command. Besides producing the executable binary it would also output a .MAP file.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"1024\" height=\"203\" src=\"https:\/\/www.logikalsolutions.com\/wordpress\/wp-content\/uploads\/2024\/02\/link-map-screenshot-1024x203.png\" alt=\"\" class=\"wp-image-6857\" srcset=\"https:\/\/www.logikalsolutions.com\/wordpress\/wp-content\/uploads\/2024\/02\/link-map-screenshot-1024x203.png 1024w, https:\/\/www.logikalsolutions.com\/wordpress\/wp-content\/uploads\/2024\/02\/link-map-screenshot-300x59.png 300w, https:\/\/www.logikalsolutions.com\/wordpress\/wp-content\/uploads\/2024\/02\/link-map-screenshot-768x152.png 768w, https:\/\/www.logikalsolutions.com\/wordpress\/wp-content\/uploads\/2024\/02\/link-map-screenshot-1200x237.png 1200w, https:\/\/www.logikalsolutions.com\/wordpress\/wp-content\/uploads\/2024\/02\/link-map-screenshot.png 1334w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Link map of simple COBOL program<\/figcaption><\/figure>\n<\/div>\n\n\n<p>Let me show you one for a BASIC language program as well.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"1024\" height=\"369\" src=\"https:\/\/www.logikalsolutions.com\/wordpress\/wp-content\/uploads\/2024\/02\/link-map-002-1024x369.png\" alt=\"\" class=\"wp-image-6858\" srcset=\"https:\/\/www.logikalsolutions.com\/wordpress\/wp-content\/uploads\/2024\/02\/link-map-002-1024x369.png 1024w, https:\/\/www.logikalsolutions.com\/wordpress\/wp-content\/uploads\/2024\/02\/link-map-002-300x108.png 300w, https:\/\/www.logikalsolutions.com\/wordpress\/wp-content\/uploads\/2024\/02\/link-map-002-768x277.png 768w, https:\/\/www.logikalsolutions.com\/wordpress\/wp-content\/uploads\/2024\/02\/link-map-002-1200x432.png 1200w, https:\/\/www.logikalsolutions.com\/wordpress\/wp-content\/uploads\/2024\/02\/link-map-002.png 1324w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Link map of simple BASIC program<\/figcaption><\/figure>\n<\/div>\n\n\n<p>I&#8217;m not going to drag you through the attribute details. Honestly I don&#8217;t remember the difference between NOPIC and PIC off the top of my head. Each PSECT has a name. Some platforms physically have DSECT terminology and others identify them as a PSECT with WRT, NOEXE attributes. (WRT = Write).<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"1024\" height=\"276\" src=\"https:\/\/www.logikalsolutions.com\/wordpress\/wp-content\/uploads\/2024\/02\/link-map-009-1024x276.png\" alt=\"\" class=\"wp-image-6861\" srcset=\"https:\/\/www.logikalsolutions.com\/wordpress\/wp-content\/uploads\/2024\/02\/link-map-009-1024x276.png 1024w, https:\/\/www.logikalsolutions.com\/wordpress\/wp-content\/uploads\/2024\/02\/link-map-009-300x81.png 300w, https:\/\/www.logikalsolutions.com\/wordpress\/wp-content\/uploads\/2024\/02\/link-map-009-768x207.png 768w, https:\/\/www.logikalsolutions.com\/wordpress\/wp-content\/uploads\/2024\/02\/link-map-009-1200x324.png 1200w, https:\/\/www.logikalsolutions.com\/wordpress\/wp-content\/uploads\/2024\/02\/link-map-009.png 1316w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">C program link map<\/figcaption><\/figure>\n<\/div>\n\n\n<p>This is one of the main distinctions between a real operating system and a home hobby platform. When you are running a program on a real operating system as a mere mortal user and your un-initialized pointer tries to write a block of text into a NWRT PSECT owned by your process the OS kills your process without a second though. On most x86 platforms that doesn&#8217;t happen.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Stack<\/h2>\n\n\n\n<p>In case it isn&#8217;t clear, PSECT is short for Program Section and DSECT is short for Data Section. In the DOS and GUI DOS (Windows) worlds where you <a href=\"https:\/\/learn.microsoft.com\/en-us\/cpp\/build\/reference\/f-set-stack-size?view=msvc-170\">set stack size<\/a> at either compile or link time, you create a DSECT of that size which gets bound into your executable. During the early years that wasn&#8217;t just a loader value but a DSECT physically linked into your executable. If you needed 30K of stack, your executable was going to be well over 30K in size. I do not know if Microsoft has since moved this to be a loader function. I also don&#8217;t know if Windows has managed to set user process level memory limits, kind of doubt it though.<\/p>\n\n\n\n<p>Linux doesn&#8217;t create a stack DSECT in the executable, at least not like the above. Instead it has <a href=\"https:\/\/linuxconfig.org\/limit-user-environment-with-ulimit-linux-command\">ulimit<\/a>. There tends to also be a limits.conf file which has the defaults for boot.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Stack Based Machine vs. Stack Based Language<\/h2>\n\n\n\n<p>Here is <a href=\"https:\/\/users.ece.cmu.edu\/~koopman\/stack_computers\/chap6.html\">a great book on stack and other computers<\/a>. I want to quote one short paragraph from it.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Three different approaches to computer design are used as reference points for this chapter. The first reference point is that of the Complex Instruction Set Computer (CISC), which is typified by Digital Equipment Corporation&#8217;s VAX series and any of the microprocessors used in personal computers (e.g. 680&#215;0, 80&#215;86). The second reference point is the Reduced Instruction Set Computer (RISC) (Patterson 1985) as typified by the Berkeley RISC project (Sequin &amp; Patterson 1982) and the Stanford MIPS project (Hennesy 1984). The third reference point is that of stack machines as described in the preceding chapters.<\/p>\n<cite>Philip Koopman, 1989<\/cite><\/blockquote>\n\n\n\n<p>Despite all of the claims of RISC computers from back in the day, pretty much every computer you work on today is CISC despite it&#8217;s claims of being RISC. They will have both registers and a program execution stack but they are not considered stack based machines by purists. I don&#8217;t wish to go down that rabbit hole. You really should give a quick read of my post titled <a href=\"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/a-c-interview-question\/\">The Closed Question<\/a> now though.<\/p>\n\n\n\n<p>Yes, the hardware and the operating system will mandate some use of the stack, but <strong><em>languages define how they use the stack<\/em><\/strong>. Pascal uses it differently that C and COBOL uses it differently than both of them. In the COBOL map above you see multiple DSECTs (NOSHR, NOEXE, WRT) declared. For BASIC and C you don&#8217;t find them because I didn&#8217;t declare any global or static data.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Deja-Vu-Mono.ttf\" style=\"font-size:.875rem;font-family:Code-Pro-Deja-Vu-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#b392f0;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1f1f1f\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"#include &lt;stdio&gt;\n#include &lt;stdlib&gt;\n#include &lt;limits&gt;\n#include &lt;time&gt;\n\nint main( int *args, char *argsv[])\n{\n\n    time_t  the_time;\n    unsigned long   u_l_x;\n\n    long        l_x, l_time;\n\n    the_time = ULONG_MAX;\n    u_l_x = the_time \/ 60u; \/\/ how many minutes\n    u_l_x \/= 60u;       \/\/ how many hours\n    u_l_x \/= 24u;       \/\/ how many days\n    u_l_x \/= 365u;      \/\/ how many years\n    u_l_x += 1970u;     \/\/ add to base year\n\n    printf( &quot;time_t will run out of precision &quot;);\n    printf( &quot;around the year %u\\n&quot;, u_l_x);\n\n\n    \/\/\n    \/\/  Some platforms had it as a long not unsigned long initially\n    \/\/\n    l_time = LONG_MAX;\n    l_x    = l_time \/ 60;\n    l_x    \/= 60;\n    l_x    \/= 24;\n    l_x    \/= 365;\n    l_x    += 1970;\n\n    printf( &quot;the old signed long version will run out of &quot;);\n    printf( &quot;precision around the year %d\\n&quot;, l_x);\n\n    return 1;\n\n}\n    \n\" style=\"color:#b392f0;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki min-dark\" style=\"background-color: #1f1f1f\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">#include<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #FFAB70\">&lt;stdio&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">#include<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #FFAB70\">&lt;stdlib&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">#include<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #FFAB70\">&lt;limits&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">#include<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #FFAB70\">&lt;time&gt;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">int<\/span><span style=\"color: #B392F0\"> main( <\/span><span style=\"color: #F97583\">int<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F97583\">*<\/span><span style=\"color: #B392F0\">args<\/span><span style=\"color: #BBBBBB\">,<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F97583\">char<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F97583\">*<\/span><span style=\"color: #B392F0\">argsv<\/span><span style=\"color: #F97583\">[]<\/span><span style=\"color: #B392F0\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">{<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #F97583\">time_t<\/span><span style=\"color: #B392F0\">  the_time;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #F97583\">unsigned<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F97583\">long<\/span><span style=\"color: #B392F0\">   u_l_x;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #F97583\">long<\/span><span style=\"color: #B392F0\">        l_x<\/span><span style=\"color: #BBBBBB\">,<\/span><span style=\"color: #B392F0\"> l_time;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    the_time <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #B392F0\"> ULONG_MAX;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    u_l_x <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #B392F0\"> the_time <\/span><span style=\"color: #F97583\">\/<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F8F8F8\">60u<\/span><span style=\"color: #B392F0\">;<\/span><span style=\"color: #6B737C\"> \/\/ how many minutes<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    u_l_x <\/span><span style=\"color: #F97583\">\/=<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F8F8F8\">60u<\/span><span style=\"color: #B392F0\">;<\/span><span style=\"color: #6B737C\">       \/\/ how many hours<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    u_l_x <\/span><span style=\"color: #F97583\">\/=<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F8F8F8\">24u<\/span><span style=\"color: #B392F0\">;<\/span><span style=\"color: #6B737C\">       \/\/ how many days<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    u_l_x <\/span><span style=\"color: #F97583\">\/=<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F8F8F8\">365u<\/span><span style=\"color: #B392F0\">;<\/span><span style=\"color: #6B737C\">      \/\/ how many years<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    u_l_x <\/span><span style=\"color: #F97583\">+=<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F8F8F8\">1970u<\/span><span style=\"color: #B392F0\">;<\/span><span style=\"color: #6B737C\">     \/\/ add to base year<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    printf( <\/span><span style=\"color: #FFAB70\">&quot;time_t will run out of precision &quot;<\/span><span style=\"color: #B392F0\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    printf( <\/span><span style=\"color: #FFAB70\">&quot;around the year <\/span><span style=\"color: #F8F8F8\">%u<\/span><span style=\"color: #FFAB70\">\\n&quot;<\/span><span style=\"color: #BBBBBB\">,<\/span><span style=\"color: #B392F0\"> u_l_x);<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #6B737C\">\/\/<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #6B737C\">\/\/  Some platforms had it as a long not unsigned long initially<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #6B737C\">\/\/<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    l_time <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #B392F0\"> LONG_MAX;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    l_x    <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #B392F0\"> l_time <\/span><span style=\"color: #F97583\">\/<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F8F8F8\">60<\/span><span style=\"color: #B392F0\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    l_x    <\/span><span style=\"color: #F97583\">\/=<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F8F8F8\">60<\/span><span style=\"color: #B392F0\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    l_x    <\/span><span style=\"color: #F97583\">\/=<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F8F8F8\">24<\/span><span style=\"color: #B392F0\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    l_x    <\/span><span style=\"color: #F97583\">\/=<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F8F8F8\">365<\/span><span style=\"color: #B392F0\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    l_x    <\/span><span style=\"color: #F97583\">+=<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F8F8F8\">1970<\/span><span style=\"color: #B392F0\">;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    printf( <\/span><span style=\"color: #FFAB70\">&quot;the old signed long version will run out of &quot;<\/span><span style=\"color: #B392F0\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    printf( <\/span><span style=\"color: #FFAB70\">&quot;precision around the year <\/span><span style=\"color: #F8F8F8\">%d<\/span><span style=\"color: #FFAB70\">\\n&quot;<\/span><span style=\"color: #BBBBBB\">,<\/span><span style=\"color: #B392F0\"> l_x);<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #F97583\">return<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F8F8F8\">1<\/span><span style=\"color: #B392F0\">;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Stack Overflow<\/h2>\n\n\n\n<p>You all think StackOverflow is just a Web site. It was, and still is, a constant problem on Microsoft operating systems. Under DOS, where we had Compact, Small, Medium, and Large memory models limiting the amount of stack we could have we did constant battle with it.<\/p>\n\n\n\n<p>The stack is the near heap. When you have something like the following code snippet<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Deja-Vu-Mono.ttf\" style=\"font-size:.875rem;font-family:Code-Pro-Deja-Vu-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#b392f0;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1f1f1f\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"void c_zill_browse_sub( int *fms_status, int *rms_status, \n                        int *tca_array, int *workspace_array)\n{\n    int                     l_x, l_load_direction;\n    int                     l_action, l_y;\n    char                    line_in[255], command_str[255];\n    FILE                    *in_file;\n\n    $DESCRIPTOR( command_str_desc, command_str);\n\n    struct  drawing_record  m_z;\n    struct  FAB             mega_fab;\n    struct  RAB             mega_rab;\n    struct  XABKEY          mega_xab;\n\n    struct  browse_screen_struct    screen_rec[L_BROWSE_SCREEN_COUNT];\n\n    $DESCRIPTOR( form_name_desc, &quot;ZILL_BROWSE&quot;);\n\n\n    \/\/\n    \/\/  attach to the mega file\n    \/\/\n    l_x = open_mega_idx( &amp;m_z, &amp;mega_fab, \n                         &amp;mega_rab, &amp;mega_xab, FAB$M_GET);\n\" style=\"color:#b392f0;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki min-dark\" style=\"background-color: #1f1f1f\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">void<\/span><span style=\"color: #B392F0\"> c_zill_browse_sub( int <\/span><span style=\"color: #F97583\">*<\/span><span style=\"color: #B392F0\">fms_status<\/span><span style=\"color: #BBBBBB\">,<\/span><span style=\"color: #B392F0\"> int <\/span><span style=\"color: #F97583\">*<\/span><span style=\"color: #B392F0\">rms_status<\/span><span style=\"color: #BBBBBB\">,<\/span><span style=\"color: #B392F0\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">                        int <\/span><span style=\"color: #F97583\">*<\/span><span style=\"color: #B392F0\">tca_array<\/span><span style=\"color: #BBBBBB\">,<\/span><span style=\"color: #B392F0\"> int <\/span><span style=\"color: #F97583\">*<\/span><span style=\"color: #B392F0\">workspace_array)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    int                     l_x<\/span><span style=\"color: #BBBBBB\">,<\/span><span style=\"color: #B392F0\"> l_load_direction;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    int                     l_action<\/span><span style=\"color: #BBBBBB\">,<\/span><span style=\"color: #B392F0\"> l_y;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    char                    line_in[<\/span><span style=\"color: #F8F8F8\">255<\/span><span style=\"color: #B392F0\">]<\/span><span style=\"color: #BBBBBB\">,<\/span><span style=\"color: #B392F0\"> command_str[<\/span><span style=\"color: #F8F8F8\">255<\/span><span style=\"color: #B392F0\">];<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #79B8FF\">FILE<\/span><span style=\"color: #B392F0\">                    <\/span><span style=\"color: #F97583\">*<\/span><span style=\"color: #B392F0\">in_file;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    $DESCRIPTOR( command_str_desc<\/span><span style=\"color: #BBBBBB\">,<\/span><span style=\"color: #B392F0\"> command_str);<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    struct  drawing_record  m_z;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    struct  <\/span><span style=\"color: #79B8FF\">FAB<\/span><span style=\"color: #B392F0\">             mega_fab;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    struct  <\/span><span style=\"color: #79B8FF\">RAB<\/span><span style=\"color: #B392F0\">             mega_rab;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    struct  <\/span><span style=\"color: #79B8FF\">XABKEY<\/span><span style=\"color: #B392F0\">          mega_xab;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    struct  browse_screen_struct    screen_rec[<\/span><span style=\"color: #79B8FF\">L_BROWSE_SCREEN_COUNT<\/span><span style=\"color: #B392F0\">];<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    $DESCRIPTOR( form_name_desc<\/span><span style=\"color: #BBBBBB\">,<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #FFAB70\">&quot;ZILL_BROWSE&quot;<\/span><span style=\"color: #B392F0\">);<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #6B737C\">\/\/<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #6B737C\">\/\/  attach to the mega file<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #6B737C\">\/\/<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    l_x <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #B392F0\"> open_mega_idx( <\/span><span style=\"color: #F97583\">&amp;<\/span><span style=\"color: #B392F0\">m_z<\/span><span style=\"color: #BBBBBB\">,<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F97583\">&amp;<\/span><span style=\"color: #B392F0\">mega_fab<\/span><span style=\"color: #BBBBBB\">,<\/span><span style=\"color: #B392F0\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">                         <\/span><span style=\"color: #F97583\">&amp;<\/span><span style=\"color: #B392F0\">mega_rab<\/span><span style=\"color: #BBBBBB\">,<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F97583\">&amp;<\/span><span style=\"color: #B392F0\">mega_xab<\/span><span style=\"color: #BBBBBB\">,<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #79B8FF\">FAB$M_GET<\/span><span style=\"color: #B392F0\">);<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>every one of those &#8220;local&#8221; variables is allocated on the stack (near heap). On Linux systems that is generally a pretty big value. On GUI DOS systems it is still bound into the executable. You can&#8217;t quick change a system setting that will let a program dying from Stack Overflow actually succeed.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/thumb\/5\/50\/Program_memory_layout.pdf\/page1-149px-Program_memory_layout.pdf.jpg\" alt=\"\"\/><\/figure>\n<\/div>\n\n\n<p>I don&#8217;t really like this image from Wikipedia but it is a start. On a real computer with a real operating system the stack gets placed at the highest memory address your user process is allowed to utilize. Windows doesn&#8217;t have good user\/process management so it has you create a stack size in the executable and it parks that somewhere in memory where writing just a tiny bit past it will cause a General Protection Fault. <\/p>\n\n\n\n<p>Don&#8217;t get hung up on the lower 3 names. They are DSECTs. Conceptually all of the constants are loaded first. (They called that &#8220;text&#8221; but it is any constant.) Next are the DSECTS for writable global\/static data compiled into the binary. Some will have values, some won&#8217;t. Your program&#8217;s executable binary tends to be loaded before the constant DSECTS. <strong>PSECTS before DSECTS<\/strong>. Doesn&#8217;t matter if your platform makes that true or not, it is how you need to remember it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Recursion Really Burns You<\/h2>\n\n\n\n<p>Let me steal a <a href=\"https:\/\/www.w3schools.com\/cpp\/cpp_functions_recursion.asp\">code sample from w3schools<\/a>.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Deja-Vu-Mono.ttf\" style=\"font-size:.875rem;font-family:Code-Pro-Deja-Vu-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#b392f0;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1f1f1f\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"int sum(int k) {\n  if (k &gt; 0) {\n    return k + sum(k - 1);\n  } else {\n    return 0;\n  }\n}\n\nint main() {\n  int result = sum(10);\n  cout &lt;&lt; result;\n  return 0;\n}\" style=\"color:#b392f0;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki min-dark\" style=\"background-color: #1f1f1f\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #B392F0\">int sum(int k) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">  <\/span><span style=\"color: #F97583\">if<\/span><span style=\"color: #B392F0\"> (k <\/span><span style=\"color: #F97583\">&gt;<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F8F8F8\">0<\/span><span style=\"color: #B392F0\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #F97583\">return<\/span><span style=\"color: #B392F0\"> k <\/span><span style=\"color: #F97583\">+<\/span><span style=\"color: #B392F0\"> sum(k <\/span><span style=\"color: #F97583\">-<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F8F8F8\">1<\/span><span style=\"color: #B392F0\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">  } <\/span><span style=\"color: #F97583\">else<\/span><span style=\"color: #B392F0\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #F97583\">return<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F8F8F8\">0<\/span><span style=\"color: #B392F0\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">  }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">}<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">int main() {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">  int result <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #B392F0\"> sum(<\/span><span style=\"color: #F8F8F8\">10<\/span><span style=\"color: #B392F0\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">  cout <\/span><span style=\"color: #F97583\">&lt;&lt;<\/span><span style=\"color: #B392F0\"> result;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">  <\/span><span style=\"color: #F97583\">return<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F8F8F8\">0<\/span><span style=\"color: #B392F0\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>This is the recursion example found at the link. Now imagine instead of being a tiny little function consuming only a few integers worth of storage on the stack that you had to allocate a whole bunch of data like the earlier code example. Easy to see how you could pop past the end of the stack. Those of you on a Windows machine with severely limited memory should try compiling that example, changing 10 to be a very large integer or shrinking the stack size really low.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Special DSECTs and RTOS<\/h2>\n\n\n\n<p>You can have a special DSECT in your program on any OS today.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"661\" height=\"226\" src=\"https:\/\/www.logikalsolutions.com\/wordpress\/wp-content\/uploads\/2024\/02\/link-map-003.png\" alt=\"\" class=\"wp-image-6859\" srcset=\"https:\/\/www.logikalsolutions.com\/wordpress\/wp-content\/uploads\/2024\/02\/link-map-003.png 661w, https:\/\/www.logikalsolutions.com\/wordpress\/wp-content\/uploads\/2024\/02\/link-map-003-300x103.png 300w\" sizes=\"(max-width: 661px) 100vw, 661px\" \/><figcaption class=\"wp-element-caption\">DSECT declaration in MACRO-32<\/figcaption><\/figure>\n<\/div>\n\n\n<p>That&#8217;s the beginning of one being declared in MACRO-32. With C\/C++ they will generally be created whenever you have global or static data. There are other ways to force their creation but we don&#8217;t need to go into platform specific things. If you are programming on an RTOS (Real Time Operating System) where are no dynamic memory allocations you have to allocate a stack\/DSECT at load time. You, then have to parcel it out a memory block at a time.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What About that Stack Portion?<\/h2>\n\n\n\n<p>I like this image from Citizendium.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/en.citizendium.org\/wiki\/images\/thumb\/1\/1e\/Stackframe.png\/370px-Stackframe.png\" alt=\"\"\/><\/figure>\n<\/div>\n\n\n<p>Every function\/method call (including main) has at least a saved FP (Frame Pointer). It may also have some parameters. After saving the Frame Pointer the local variables are created at the &#8220;top&#8221; of the stack. I&#8217;m not going to take you deep here. Traditionally Register Zero (R0) is used for any integer return values, other return values, like a std::string have to be returned via other means.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How Does This Relate to Defaults and Deletes?<\/h2>\n\n\n\n<p>I&#8217;m glad you asked.<\/p>\n\n\n\n<p>That Frame Pointer is reset to the saved FP value and the Stack Pointer (SP) is changed to be the old FP value, conceptually. Compiler developers and hardware geeks are rounding up torches and pitchforks for my telling you that, but as a developer you need to understand it this way.<\/p>\n\n\n\n<p class=\"has-text-align-center\"><strong>The Default Destructor doesn&#8217;t do anything.<\/strong><\/p>\n\n\n\n<p>Returning from the function changes the SP and FP but the chunk of memory that held parameters, return address, and locals is still there and still has its values.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Deja-Vu-Mono.ttf\" style=\"font-size:.875rem;font-family:Code-Pro-Deja-Vu-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#b392f0;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1f1f1f\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"std::string *obscureBug( some parameters )\n{\n    std::string str {&quot;My fellow Americans&quot;};\n\n    \/\/ some more code\n    \n    return (&amp;str);\n}\n\" style=\"color:#b392f0;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki min-dark\" style=\"background-color: #1f1f1f\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #B392F0\">std::string <\/span><span style=\"color: #F97583\">*<\/span><span style=\"color: #B392F0\">obscureBug( some parameters )<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    std::string str {<\/span><span style=\"color: #FFAB70\">&quot;My fellow Americans&quot;<\/span><span style=\"color: #B392F0\">};<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #6B737C\">\/\/ some more code<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #F97583\">return<\/span><span style=\"color: #B392F0\"> (<\/span><span style=\"color: #F97583\">&amp;<\/span><span style=\"color: #B392F0\">str);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">}<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>I love these bugs and it doesn&#8217;t matter if the above code compiles. This is the kind of bug Newbs introduce all the time. You return the address of a local variable. Depending on your compiler, this bug could exist for decades. Won&#8217;t be found until someone inserts a method\/function call between the return from this function and use of its result. When yo look at the stack image above, you begin to understand why. <\/p>\n\n\n\n<p>The data was just left lying around. <\/p>\n\n\n\n<p>The destructor for std::string isn&#8217;t required to nuke everything when it goes out of scope. Exactly when the destructor gets called is rather fuzzy too. Let&#8217;s look at <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/language\/destructor\">the official language<\/a>.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"807\" height=\"274\" src=\"https:\/\/www.logikalsolutions.com\/wordpress\/wp-content\/uploads\/2024\/02\/destructor-101.png\" alt=\"\" class=\"wp-image-6863\" srcset=\"https:\/\/www.logikalsolutions.com\/wordpress\/wp-content\/uploads\/2024\/02\/destructor-101.png 807w, https:\/\/www.logikalsolutions.com\/wordpress\/wp-content\/uploads\/2024\/02\/destructor-101-300x102.png 300w, https:\/\/www.logikalsolutions.com\/wordpress\/wp-content\/uploads\/2024\/02\/destructor-101-768x261.png 768w\" sizes=\"(max-width: 807px) 100vw, 807px\" \/><\/figure>\n<\/div>\n\n\n<p>You will notice there are no hard\/fast rules stating &#8220;immediately, halt all other execution until complete.&#8221; A destructor&#8217;s only obligation is to free allocated resources. There is no scorched Earth requirement. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Happens in Plain Old C as Well<\/h2>\n\n\n\n<p>Fine, let&#8217;s take classes out of the example.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Deja-Vu-Mono.ttf\" style=\"font-size:.875rem;font-family:Code-Pro-Deja-Vu-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#b392f0;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1f1f1f\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"char *obscureBugToo( some parameters)\n{\n    char buffer[2048];\n\n    \/\/ some code\n\n    return (buffer);\n}\n\" style=\"color:#b392f0;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki min-dark\" style=\"background-color: #1f1f1f\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">char<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F97583\">*<\/span><span style=\"color: #B392F0\">obscureBugToo( some parameters)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #F97583\">char<\/span><span style=\"color: #B392F0\"> buffer[<\/span><span style=\"color: #F8F8F8\">2048<\/span><span style=\"color: #B392F0\">];<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #6B737C\">\/\/ some code<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #F97583\">return<\/span><span style=\"color: #B392F0\"> (buffer);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">}<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Just about every Newb developer writing their first Serial Port or other random streaming type input function makes <em>exactly<\/em> this mistake. They return a pointer to a locally allocated buffer. &#8220;Works&#8221; for years until someone inserts another function call between getting the pointer return value and its first use. That function has parameters and local variables that now overwrite that unused portion of stack. Everybody points a finger at the dude who inserted the function call because &#8220;This has worked for years!&#8221;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Where This Really Matters<\/h2>\n\n\n\n<p>I don&#8217;t care if this code compiles or not. Yes, I hate it when people put code in a header file as well.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Deja-Vu-Mono.ttf\" style=\"font-size:.875rem;font-family:Code-Pro-Deja-Vu-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#b392f0;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1f1f1f\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"class WhizzyPuffle\n{\npublic:\n    WhizzyPuffle::WhizzyPuffle( int a, double b, char *buffer) :\n        m_a( a),\n        m_b( b),\n        m_buffer( buffer) {};\n    \n    WhizzyPuffle::WhizzyPuffle() { m_buffer = new char[2048];};\n\nprivate:\n    int m_a {23};\n    double m_b {14.56};\n    char *m_buffer {};\n};\" style=\"color:#b392f0;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki min-dark\" style=\"background-color: #1f1f1f\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #B392F0\">class WhizzyPuffle<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">public:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    WhizzyPuffle::WhizzyPuffle( <\/span><span style=\"color: #F97583\">int<\/span><span style=\"color: #B392F0\"> a<\/span><span style=\"color: #BBBBBB\">,<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F97583\">double<\/span><span style=\"color: #B392F0\"> b<\/span><span style=\"color: #BBBBBB\">,<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F97583\">char<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F97583\">*<\/span><span style=\"color: #B392F0\">buffer) :<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">        m_a( a)<\/span><span style=\"color: #BBBBBB\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">        m_b( b)<\/span><span style=\"color: #BBBBBB\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">        m_buffer( buffer) {};<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    WhizzyPuffle::WhizzyPuffle() { m_buffer <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #B392F0\"> new <\/span><span style=\"color: #F97583\">char<\/span><span style=\"color: #B392F0\">[<\/span><span style=\"color: #F8F8F8\">2048<\/span><span style=\"color: #B392F0\">];};<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">private:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #F97583\">int<\/span><span style=\"color: #B392F0\"> m_a {<\/span><span style=\"color: #F8F8F8\">23<\/span><span style=\"color: #B392F0\">};<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #F97583\">double<\/span><span style=\"color: #B392F0\"> m_b {<\/span><span style=\"color: #F8F8F8\">14.56<\/span><span style=\"color: #B392F0\">};<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #F97583\">char<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F97583\">*<\/span><span style=\"color: #B392F0\">m_buffer {};<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">};<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><strong><em>If<\/em><\/strong> your compiler creates a &#8220;default deconstructor&#8221; it won&#8217;t free that buffer because the default deconstructor does nothing. When we allocated a new character buffer it was in the <strong>far heap<\/strong>. The local object containing the pointer to the allocation is on the <strong>near heap<\/strong> which kids today are calling the stack.<\/p>\n\n\n\n<p>Please scroll back to the image from Citizendium. Notice the small print to the far right of parameters and locals. That (FP + K)\u2002and (FP &#8211; K) stuff. The near heap is accessed via the Frame Pointer. You cannot negative reference the Stack Pointer but you can the Frame Pointer.<\/p>\n\n\n\n<p>Our next installment will more fully flesh out the code for the example application. <strong>You need to understand the near and far heap to be an effective C\/C++ programmer.<\/strong> What does and doesn&#8217;t happen with default constructors and destructors should make more sense to you now.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Before we go much further with this discussion on Defaults and Deletes, I need you to read the section titled Near Heap in this blog post. It&#8217;s a short read with pictures. Then you need to go thank the fools . . . err . . . &#8220;learned academics&#8221;, cough cough, who re-purposed the word heap to be a binary tree data structure. To understand why things are the way they are, I need you &hellip; <a title=\"C++ \u2013 Defaults and Deletes \u2013 Pt. 2\" class=\"bnm-read-more\" href=\"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/heap\/\"><span class=\"screen-reader-text\">C++ \u2013 Defaults and Deletes \u2013 Pt. 2<\/span>Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":6848,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[1504,2203,2201,2202],"class_list":["post-6856","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-information-technology","tag-c","tag-dsect","tag-heap","tag-psect","bnm-entry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>C++ \u2013 Defaults and Deletes \u2013 Pt. 2 &#8211; Logikal Blog<\/title>\n<meta name=\"description\" content=\"Before we go much further with this discussion on Defaults and Deletes, I need you to read the section titled Near Heap in this blog post.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/heap\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C++ \u2013 Defaults and Deletes \u2013 Pt. 2 &#8211; Logikal Blog\" \/>\n<meta property=\"og:description\" content=\"Before we go much further with this discussion on Defaults and Deletes, I need you to read the section titled Near Heap in this blog post.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/heap\/\" \/>\n<meta property=\"og:site_name\" content=\"Logikal Blog\" \/>\n<meta property=\"article:published_time\" content=\"2024-02-05T18:42:26+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-02-05T18:42:27+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.logikalsolutions.com\/wordpress\/wp-content\/uploads\/2024\/02\/cpp-icon.png\" \/>\n\t<meta property=\"og:image:width\" content=\"256\" \/>\n\t<meta property=\"og:image:height\" content=\"288\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"seasoned_geek\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"seasoned_geek\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/information-technology\\\/heap\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/information-technology\\\/heap\\\/\"},\"author\":{\"name\":\"seasoned_geek\",\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/#\\\/schema\\\/person\\\/c077f770ade13de7faaf616c3eac6842\"},\"headline\":\"C++ \u2013 Defaults and Deletes \u2013 Pt. 2\",\"datePublished\":\"2024-02-05T18:42:26+00:00\",\"dateModified\":\"2024-02-05T18:42:27+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/information-technology\\\/heap\\\/\"},\"wordCount\":1847,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/#\\\/schema\\\/person\\\/c077f770ade13de7faaf616c3eac6842\"},\"image\":{\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/information-technology\\\/heap\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/wp-content\\\/uploads\\\/2024\\\/02\\\/cpp-icon.png\",\"keywords\":[\"C++\",\"DSECT\",\"heap\",\"PSECT\"],\"articleSection\":[\"Information Technology\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/information-technology\\\/heap\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/information-technology\\\/heap\\\/\",\"url\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/information-technology\\\/heap\\\/\",\"name\":\"C++ \u2013 Defaults and Deletes \u2013 Pt. 2 &#8211; Logikal Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/information-technology\\\/heap\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/information-technology\\\/heap\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/wp-content\\\/uploads\\\/2024\\\/02\\\/cpp-icon.png\",\"datePublished\":\"2024-02-05T18:42:26+00:00\",\"dateModified\":\"2024-02-05T18:42:27+00:00\",\"description\":\"Before we go much further with this discussion on Defaults and Deletes, I need you to read the section titled Near Heap in this blog post.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/information-technology\\\/heap\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/information-technology\\\/heap\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/information-technology\\\/heap\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/wp-content\\\/uploads\\\/2024\\\/02\\\/cpp-icon.png\",\"contentUrl\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/wp-content\\\/uploads\\\/2024\\\/02\\\/cpp-icon.png\",\"width\":256,\"height\":288,\"caption\":\"C++ image from icons-library.com\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/information-technology\\\/heap\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"C++ \u2013 Defaults and Deletes \u2013 Pt. 2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/#website\",\"url\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/\",\"name\":\"Logikal Blog\",\"description\":\"For people with attention spans longer than a Tweet\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/#\\\/schema\\\/person\\\/c077f770ade13de7faaf616c3eac6842\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/#\\\/schema\\\/person\\\/c077f770ade13de7faaf616c3eac6842\",\"name\":\"seasoned_geek\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ae9adac14079d84b909e635d7af986fe4568053af4fd9ff8d4109298c392493e?s=96&d=mm&r=r\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ae9adac14079d84b909e635d7af986fe4568053af4fd9ff8d4109298c392493e?s=96&d=mm&r=r\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ae9adac14079d84b909e635d7af986fe4568053af4fd9ff8d4109298c392493e?s=96&d=mm&r=r\",\"caption\":\"seasoned_geek\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ae9adac14079d84b909e635d7af986fe4568053af4fd9ff8d4109298c392493e?s=96&d=mm&r=r\"},\"description\":\"Roland Hughes started his IT career in the early 1980s. He quickly became a consultant and president of Logikal Solutions, a software consulting firm specializing in OpenVMS application and C++\\\/Qt touchscreen\\\/embedded Linux development. Early in his career he became involved in what is now called cross platform development. Given the dearth of useful books on the subject he ventured into the world of professional author in 1995 writing the first of the \\\"Zinc It!\\\" book series for John Gordon Burke Publisher, Inc. A decade later he released a massive (nearly 800 pages) tome \\\"The Minimum You Need to Know to Be an OpenVMS Application Developer\\\" which tried to encapsulate the essential skills gained over what was nearly a 20 year career at that point. From there \\\"The Minimum You Need to Know\\\" book series was born. Three years later he wrote his first novel \\\"Infinite Exposure\\\" which got much notice from people involved in the banking and financial security worlds. Some of the attacks predicted in that book have since come to pass. While it was not originally intended to be a trilogy, it became the first book of \\\"The Earth That Was\\\" trilogy: Infinite Exposure Lesedi - The Greatest Lie Ever Told John Smith - Last Known Survivor of the Microsoft Wars When he is not consulting Roland Hughes posts about technology and sometimes politics on his blog. He also has regularly scheduled Sunday posts appearing on the Interesting Authors blog.\",\"sameAs\":[\"https:\\\/\\\/theminimumyouneedtoknow.com\"],\"url\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/author\\\/seasoned_geek\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"C++ \u2013 Defaults and Deletes \u2013 Pt. 2 &#8211; Logikal Blog","description":"Before we go much further with this discussion on Defaults and Deletes, I need you to read the section titled Near Heap in this blog post.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/heap\/","og_locale":"en_US","og_type":"article","og_title":"C++ \u2013 Defaults and Deletes \u2013 Pt. 2 &#8211; Logikal Blog","og_description":"Before we go much further with this discussion on Defaults and Deletes, I need you to read the section titled Near Heap in this blog post.","og_url":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/heap\/","og_site_name":"Logikal Blog","article_published_time":"2024-02-05T18:42:26+00:00","article_modified_time":"2024-02-05T18:42:27+00:00","og_image":[{"width":256,"height":288,"url":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-content\/uploads\/2024\/02\/cpp-icon.png","type":"image\/png"}],"author":"seasoned_geek","twitter_card":"summary_large_image","twitter_misc":{"Written by":"seasoned_geek","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/heap\/#article","isPartOf":{"@id":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/heap\/"},"author":{"name":"seasoned_geek","@id":"https:\/\/www.logikalsolutions.com\/wordpress\/#\/schema\/person\/c077f770ade13de7faaf616c3eac6842"},"headline":"C++ \u2013 Defaults and Deletes \u2013 Pt. 2","datePublished":"2024-02-05T18:42:26+00:00","dateModified":"2024-02-05T18:42:27+00:00","mainEntityOfPage":{"@id":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/heap\/"},"wordCount":1847,"commentCount":1,"publisher":{"@id":"https:\/\/www.logikalsolutions.com\/wordpress\/#\/schema\/person\/c077f770ade13de7faaf616c3eac6842"},"image":{"@id":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/heap\/#primaryimage"},"thumbnailUrl":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-content\/uploads\/2024\/02\/cpp-icon.png","keywords":["C++","DSECT","heap","PSECT"],"articleSection":["Information Technology"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/heap\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/heap\/","url":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/heap\/","name":"C++ \u2013 Defaults and Deletes \u2013 Pt. 2 &#8211; Logikal Blog","isPartOf":{"@id":"https:\/\/www.logikalsolutions.com\/wordpress\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/heap\/#primaryimage"},"image":{"@id":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/heap\/#primaryimage"},"thumbnailUrl":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-content\/uploads\/2024\/02\/cpp-icon.png","datePublished":"2024-02-05T18:42:26+00:00","dateModified":"2024-02-05T18:42:27+00:00","description":"Before we go much further with this discussion on Defaults and Deletes, I need you to read the section titled Near Heap in this blog post.","breadcrumb":{"@id":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/heap\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/heap\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/heap\/#primaryimage","url":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-content\/uploads\/2024\/02\/cpp-icon.png","contentUrl":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-content\/uploads\/2024\/02\/cpp-icon.png","width":256,"height":288,"caption":"C++ image from icons-library.com"},{"@type":"BreadcrumbList","@id":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/heap\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.logikalsolutions.com\/wordpress\/"},{"@type":"ListItem","position":2,"name":"C++ \u2013 Defaults and Deletes \u2013 Pt. 2"}]},{"@type":"WebSite","@id":"https:\/\/www.logikalsolutions.com\/wordpress\/#website","url":"https:\/\/www.logikalsolutions.com\/wordpress\/","name":"Logikal Blog","description":"For people with attention spans longer than a Tweet","publisher":{"@id":"https:\/\/www.logikalsolutions.com\/wordpress\/#\/schema\/person\/c077f770ade13de7faaf616c3eac6842"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.logikalsolutions.com\/wordpress\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.logikalsolutions.com\/wordpress\/#\/schema\/person\/c077f770ade13de7faaf616c3eac6842","name":"seasoned_geek","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/ae9adac14079d84b909e635d7af986fe4568053af4fd9ff8d4109298c392493e?s=96&d=mm&r=r","url":"https:\/\/secure.gravatar.com\/avatar\/ae9adac14079d84b909e635d7af986fe4568053af4fd9ff8d4109298c392493e?s=96&d=mm&r=r","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ae9adac14079d84b909e635d7af986fe4568053af4fd9ff8d4109298c392493e?s=96&d=mm&r=r","caption":"seasoned_geek"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/ae9adac14079d84b909e635d7af986fe4568053af4fd9ff8d4109298c392493e?s=96&d=mm&r=r"},"description":"Roland Hughes started his IT career in the early 1980s. He quickly became a consultant and president of Logikal Solutions, a software consulting firm specializing in OpenVMS application and C++\/Qt touchscreen\/embedded Linux development. Early in his career he became involved in what is now called cross platform development. Given the dearth of useful books on the subject he ventured into the world of professional author in 1995 writing the first of the \"Zinc It!\" book series for John Gordon Burke Publisher, Inc. A decade later he released a massive (nearly 800 pages) tome \"The Minimum You Need to Know to Be an OpenVMS Application Developer\" which tried to encapsulate the essential skills gained over what was nearly a 20 year career at that point. From there \"The Minimum You Need to Know\" book series was born. Three years later he wrote his first novel \"Infinite Exposure\" which got much notice from people involved in the banking and financial security worlds. Some of the attacks predicted in that book have since come to pass. While it was not originally intended to be a trilogy, it became the first book of \"The Earth That Was\" trilogy: Infinite Exposure Lesedi - The Greatest Lie Ever Told John Smith - Last Known Survivor of the Microsoft Wars When he is not consulting Roland Hughes posts about technology and sometimes politics on his blog. He also has regularly scheduled Sunday posts appearing on the Interesting Authors blog.","sameAs":["https:\/\/theminimumyouneedtoknow.com"],"url":"https:\/\/www.logikalsolutions.com\/wordpress\/author\/seasoned_geek\/"}]}},"_links":{"self":[{"href":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-json\/wp\/v2\/posts\/6856","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-json\/wp\/v2\/comments?post=6856"}],"version-history":[{"count":0,"href":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-json\/wp\/v2\/posts\/6856\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-json\/wp\/v2\/media\/6848"}],"wp:attachment":[{"href":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-json\/wp\/v2\/media?parent=6856"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-json\/wp\/v2\/categories?post=6856"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-json\/wp\/v2\/tags?post=6856"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}