{"id":5033,"date":"2014-03-30T18:08:08","date_gmt":"2014-03-30T18:08:08","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/explaining-copy-constructor-example-collection-of-common-programming-errors\/"},"modified":"2014-03-30T18:08:08","modified_gmt":"2014-03-30T18:08:08","slug":"explaining-copy-constructor-example-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/explaining-copy-constructor-example-collection-of-common-programming-errors\/","title":{"rendered":"Explaining copy constructor example-Collection of common programming errors"},"content":{"rendered":"<p>Print the address of the memory being freed.<\/p>\n<p>I believe you will find the compiler generated the constructor for you, did a value copy of the contents, including the pointer, and you are double-freeing the pointer and just getting lucky that the runtime isn&#8217;t complaining about it.<\/p>\n<p>The compiler generated copy constructor is still being called &#8211; nothing has changed in that regard, you just aren&#8217;t printing anything from it since you didn&#8217;t write it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Print the address of the memory being freed. I believe you will find the compiler generated the constructor for you, did a value copy of the contents, including the pointer, and you are double-freeing the pointer and just getting lucky that the runtime isn&#8217;t complaining about it. The compiler generated copy constructor is still being [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5033","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5033","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=5033"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5033\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5033"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5033"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5033"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}