{"id":306,"date":"2006-08-28T14:31:19","date_gmt":"2006-08-28T14:31:19","guid":{"rendered":"http:\/\/www.icemark.com\/blog\/archives\/2006\/08\/28\/doomdarks-revenge-6\/"},"modified":"2011-03-08T01:08:42","modified_gmt":"2011-03-08T01:08:42","slug":"doomdarks-revenge-6","status":"publish","type":"post","link":"https:\/\/www.icemark.com\/blog\/archives\/2006\/08\/28\/doomdarks-revenge-6\/","title":{"rendered":"Doomdark&#8217;s Revenge"},"content":{"rendered":"<p>I sat down today to do some DDR code, first in a while, and spent 3 hours debugging some crashes!<\/p>\n<p>Don&#8217;t you just hate it when you leave your code in a none working state! One was some bad XML, incorrect closing elements, and the other was some memory being trashed. The memory problem was due to my string class doing a shallow copy on assignment&#8230; well actually it wasn&#8217;t, but the compiler was for some reason not using my string assignment operator and instead doing it itself! Actually I have no idea what the compiler is doing at that point&#8230; grr&#8230;<br \/>\n<!--more|inline--><br \/>\nIt seems that the compiler differentiates between these two bits of code&#8230;<\/p>\n<p>figure1<br \/>\n<code><br \/>\nint example_function ( const string& source )<br \/>\n{<br \/>\n   string new_string = source ;<br \/>\n}<br \/>\n<\/code><\/p>\n<p>figure2<br \/>\n<code><br \/>\nint example_function ( const string& source )<br \/>\n{<br \/>\n   string new_string ;<\/p>\n<p>   new_string = source ;<br \/>\n}<br \/>\n<\/code><\/p>\n<p>figure2 creates the correct constructor code for new_string and the correct assignment operator call for new_string = source. Figure one just makes new_string exactly equal to source. I think I must be missing something somewhere!<\/p>\n<a href=\"http:\/\/technorati.com\/tags\/\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.icemark.com\/blog\/wp-images\/technorati_small.gif\" width=\"16\" height=\"15\" alt=\"Technorati\"\/><\/a> <a target=\"_blank\" alt=\"C++\" title=\"C++\" href=\"http:\/\/technorati.com\/tag\/C%2B%2B\" rel=\"tag\" >C++<\/a>, <a target=\"_blank\" alt=\"programming\" title=\"programming\" href=\"http:\/\/technorati.com\/tag\/programming\" rel=\"tag\" >programming<\/a>, <a target=\"_blank\" alt=\"source\" title=\"source\" href=\"http:\/\/technorati.com\/tag\/source\" rel=\"tag\" >source<\/a>, <a target=\"_blank\" alt=\"string\" title=\"string\" href=\"http:\/\/technorati.com\/tag\/string\" rel=\"tag\" >string<\/a>, <a target=\"_blank\" alt=\"constructor\" title=\"constructor\" href=\"http:\/\/technorati.com\/tag\/constructor\" rel=\"tag\" >constructor<\/a>, <a target=\"_blank\" alt=\"operator\" title=\"operator\" href=\"http:\/\/technorati.com\/tag\/operator\" rel=\"tag\" >operator<\/a><br\/>\n<h3 class='related_post_title'>Related Posts:<\/h3><ul class='related_post'><li><a href=\"http:\/\/www.icemark.com\/blog\/archives\/2007\/06\/18\/doomdarks-revenge-7\/\" title=\"Doomdark&#8217;s Revenge\">Doomdark&#8217;s Revenge<\/a><\/li><li><a href=\"http:\/\/www.icemark.com\/blog\/archives\/2006\/04\/24\/doomdarks-revenge-5\/\" title=\"Doomdark&#8217;s Revenge \">Doomdark&#8217;s Revenge <\/a><\/li><li><a href=\"http:\/\/www.icemark.com\/blog\/archives\/2005\/11\/20\/doomdarks-revenge-4\/\" title=\"Doomdark&#8217;s Revenge &#8211; Mist\">Doomdark&#8217;s Revenge &#8211; Mist<\/a><\/li><li><a href=\"http:\/\/www.icemark.com\/blog\/archives\/2005\/11\/18\/doomdarks-revenge-3\/\" title=\"Doomdark&#8217;s Revenge\">Doomdark&#8217;s Revenge<\/a><\/li><li><a href=\"http:\/\/www.icemark.com\/blog\/archives\/2005\/11\/17\/doomdarks-jigsaw-puzzle\/\" title=\"Doomdark&#8217;s Jigsaw Puzzle\">Doomdark&#8217;s Jigsaw Puzzle<\/a><\/li><\/ul>","protected":false},"excerpt":{"rendered":"<p>I sat down today to do some DDR code, first in a while, and spent 3 hours debugging some crashes! Don&#8217;t you just hate it when you leave your code in a none working state! One was some bad XML, incorrect closing elements, and the other was some memory being trashed. The memory problem was &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.icemark.com\/blog\/archives\/2006\/08\/28\/doomdarks-revenge-6\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Doomdark&#8217;s Revenge&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_newsletter_tier_id":0,"footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[21,28,26],"tags":[237,236,223],"class_list":["post-306","post","type-post","status-publish","format-standard","hentry","category-coding","category-ddr","category-engine","tag-ddr","tag-engine","tag-midnight"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pwn4r-4W","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.icemark.com\/blog\/wp-json\/wp\/v2\/posts\/306","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.icemark.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.icemark.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.icemark.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.icemark.com\/blog\/wp-json\/wp\/v2\/comments?post=306"}],"version-history":[{"count":1,"href":"https:\/\/www.icemark.com\/blog\/wp-json\/wp\/v2\/posts\/306\/revisions"}],"predecessor-version":[{"id":834,"href":"https:\/\/www.icemark.com\/blog\/wp-json\/wp\/v2\/posts\/306\/revisions\/834"}],"wp:attachment":[{"href":"https:\/\/www.icemark.com\/blog\/wp-json\/wp\/v2\/media?parent=306"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.icemark.com\/blog\/wp-json\/wp\/v2\/categories?post=306"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.icemark.com\/blog\/wp-json\/wp\/v2\/tags?post=306"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}