{"id":105,"date":"2009-11-05T22:58:36","date_gmt":"2009-11-05T14:58:36","guid":{"rendered":"http:\/\/hgc43160.chinaw3.com\/?p=105"},"modified":"2009-11-05T22:58:36","modified_gmt":"2009-11-05T14:58:36","slug":"c%e5%b8%b8%e8%a7%81%e9%94%99%e8%af%af%e4%b9%8b%e4%b8%80-%e3%80%80%e3%80%80new%e4%b8%8edelete","status":"publish","type":"post","link":"http:\/\/www.hyzgame.com\/?p=105","title":{"rendered":"C++\u5e38\u89c1\u9519\u8bef\u4e4b\u4e00 \u3000\u3000new[]\u4e0edelete[]"},"content":{"rendered":"<p><span style=\"color: #008000;\">int\u00a0*data;<\/p>\n<p>data=new\u00a0int[100];<\/p>\n<p>delete\u00a0data;<br \/>\n<\/span><br \/>\n\u4ee5\u4e0a\u7a0b\u5e8f\u5728Visual\u00a0C++\u00a06.0\u4e2d\u662f\u6b63\u786e\u7684\uff0c\u7136\u800c\u5728\u6700\u65b0\u7684ANSI\/ISO\u00a0C++\u6807\u51c6\u4e2d\uff0c\u5b83\u5374\u662f\u9519\u8bef\u7684\u3002<\/p>\n<p>\u5728\u4ee5\u5f80\u7684\u65e5\u5b50\u91cc\uff0c\u6211\u4e5f\u4e00\u76f4\u8fd9\u4e48\u5199\u3002\u6628\u65e5\u5728\u4f7f\u7528CodeGuard\u9664\u9519\uff0c\u53d1\u73b0\u5728delete\u00a0data\u4e00\u884c\u65f6\u62a5\u544a\u8d44\u6e90\u7c7b\u578b\u4e0d\u5339\u914d\u3002\u4e00\u67e5CodeGuard\u62a5\u544a\uff0c\u63d0\u793a\u4f7f\u7528new\u00a0[]\u5f62\u5f0f\u521b\u5efa\u7684\u8d44\u6e90\u8981\u4f7f\u7528delete\u00a0[]\u91ca\u653e\u3002\u6240\u4ee5\u6b63\u786e\u7684\u7a0b\u5e8f\u5e94\u8be5\u5982\u4e0b\uff1a<\/p>\n<p><span style=\"color: #008000;\">int\u00a0*data;<\/p>\n<p>data=new\u00a0int[100];<\/p>\n<p>delete[]\u00a0data;<br \/>\n<\/span><br \/>\n\u4ee5\u4e0a\u7684\u7a0b\u5e8f\u5728 Borland\u00a0C++\u00a0Builder\u00a06\u00a0\u4e2d\u6d4b\u8bd5\u901a\u8fc7\uff0cCodeGuard\u5bf9\u672a\u4fee\u6539\u7684\u9519\u8bef\u7a0b\u5e8f\u62a5\u544a\u5982\u4e0b\uff1a<\/p>\n<p><span style=\"color: #000080;\">Error\u00a000019.\u00a00x350010\u00a0(Thread\u00a00x04F4):<br \/>\nResource\u00a0type\u00a0mismatch:\u00a0a(n)\u00a0object\u00a0was\u00a0expected.<br \/>\ndelete(0x00CF5244)<\/p>\n<p>Call\u00a0Tree:<br \/>\n0x004011C0(=NDTest.exe:0x01:0001C0)\u00a0D:\\Program\u00a0Files\\Borland\\CBuilder6\\Projects\\NDTest\\MainUnit.cpp#15<br \/>\n0x3266FFB3(=CC3260.DLL:0x01:06EFB3)<\/p>\n<p>The\u00a0object\u00a0array\u00a0(0x00CF5244)\u00a0[size:\u00a0400\u00a0bytes]\u00a0was\u00a0created\u00a0with\u00a0new[]<br \/>\nCall\u00a0Tree:<br \/>\n0x004011B4(=NDTest.exe:0x01:0001B4)\u00a0D:\\Program\u00a0Files\\Borland\\CBuilder6\\Projects\\NDTest\\MainUnit.cpp#13<br \/>\n0x3266FFB3(=CC3260.DLL:0x01:06EFB3)<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/>\nFunctions\u00a0called:<br \/>\ndelete\u00a0(25\u00a0times)<br \/>\nrealloc\u00a0(1\u00a0times)<br \/>\nmemcpy\u00a0(1\u00a0times)<br \/>\ndelete[]\u00a0(2\u00a0times)<br \/>\nfree\u00a0(15\u00a0times)<br \/>\nnew[]\u00a0(15\u00a0times)<br \/>\nnew\u00a0(29\u00a0times)<br \/>\ncalloc\u00a0(5\u00a0times)<br \/>\nmalloc\u00a0(9\u00a0times)<br \/>\nResource\u00a0types\u00a0used:<br \/>\nobject\u00a0array\u00a0(15\u00a0allocs,\u00a014\u00a0max)<br \/>\nobject\u00a0(29\u00a0allocs,\u00a017\u00a0max)<br \/>\nmemory\u00a0block\u00a0(15\u00a0allocs,\u00a010\u00a0max)<br \/>\nModules\u00a0used:<br \/>\n00400000\u00a005\/13\/2003\u00a010:56:46\u00a0D:\\Program<br \/>\nFiles\\Borland\\CBuilder6\\Projects\\NDTest\\NDTest.exe<br \/>\n0CD00000\u00a001\/30\/2002\u00a017:38:38\u00a0D:\\PROGRA~1\\Borland\\CBUILD~1\\Bin\\CG32.DLL<br \/>\n32600000\u00a001\/30\/2003\u00a006:04:00\u00a0D:\\PROGRA~1\\Borland\\CBUILD~1\\Bin\\CC3260.DLL<br \/>\n65D20000\u00a007\/22\/2002\u00a012:05:04\u00a0C:\\WINNT\\System32\\USP10.dll<br \/>\n6C330000\u00a007\/22\/2002\u00a012:05:04\u00a0C:\\WINNT\\System32\\LPK.DLL<br \/>\n75E00000\u00a007\/22\/2002\u00a012:05:04\u00a0C:\\WINNT\\System32\\IMM32.DLL<br \/>\n77D90000\u00a011\/11\/2002\u00a015:33:44\u00a0C:\\WINNT\\system32\\ADVAPI32.DLL<br \/>\n77DF0000\u00a011\/04\/2002\u00a010:58:50\u00a0C:\\WINNT\\system32\\USER32.DLL<br \/>\n77E60000\u00a011\/04\/2002\u00a010:58:54\u00a0C:\\WINNT\\system32\\KERNEL32.DLL<br \/>\n77F40000\u00a007\/23\/2002\u00a016:34:08\u00a0C:\\WINNT\\system32\\GDI32.dll<br \/>\n77F80000\u00a004\/04\/2003\u00a015:47:22\u00a0C:\\WINNT\\system32\\ntdll.dll<br \/>\n786F0000\u00a011\/20\/2002\u00a016:53:24\u00a0C:\\WINNT\\system32\\RPCRT4.dll<br \/>\n==========================================<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>int\u00a0*data; data=new\u00a0int[100]; delete\u00a0data; \u4ee5\u4e0a\u7a0b\u5e8f\u5728Visual\u00a0 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-105","post","type-post","status-publish","format-standard","hentry","category-cc"],"_links":{"self":[{"href":"http:\/\/www.hyzgame.com\/index.php?rest_route=\/wp\/v2\/posts\/105","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.hyzgame.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.hyzgame.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.hyzgame.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.hyzgame.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=105"}],"version-history":[{"count":1,"href":"http:\/\/www.hyzgame.com\/index.php?rest_route=\/wp\/v2\/posts\/105\/revisions"}],"predecessor-version":[{"id":106,"href":"http:\/\/www.hyzgame.com\/index.php?rest_route=\/wp\/v2\/posts\/105\/revisions\/106"}],"wp:attachment":[{"href":"http:\/\/www.hyzgame.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=105"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.hyzgame.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=105"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.hyzgame.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}