?????????????C++??????????????????????????????????????????????к??????????????????????д???????????????????????????????“???????紂?????????????GIS”?????????????????????????????C++??????????????????????????????????????????????????????????????????????????

????C++????????????????????????????????????????????????????C++????????????????????????????????C++??д????????????????????C++????????????? ???????????????????????????????? ???????????????? ????C++???????????????????????????????????????????????й????????? ??????????????е?????????????????????д???????????????е???????????????????????

????????????????“863”??????“???????紂?????????????GIS”?????????????C++/MFC??д????????????Visual Studio .net 2003??????????????????????????????????C++???????????????????????????????????????????????????????????????????????????????

????1?????C++???????淶????÷?????????

????????淶???????????????????????????????顣?????????????Ч???????????????????????Σ????????????????????????????????????б??????

??????1?????????????麯????????y?????????????????麯????

??????2??????????з?????й??????????????в?????????

??????3????????????new??delete????????delete?????new???????棬delete[]???new[]???????檔

??????4?????????????????????????????????????????????????

??????5????????????з???????????????????????????????????????????????????????????????????

??????????????C++?е???÷?RAII??RAII???????????????????????????????????????л???????????????????????????[2]????????????????????????????????????????????????????????????t?????????????????????????ownership????????ν?????????STL?е?auto_ptr?????????????????????????????????????????????????????????STL?????С?Boost??[3]???????????????????ü????????У?shared_ptr????????????????STL?????С?????????ο?????[3]??

????1.1 ????淶??鶴?? CodeWizard

????CodeWizard?????????????????????衢???????顣???????Υ???????????????????????????????????????CodeWizard 4.3 ??????????????????500??????????CodeWizard??????????????????????Щ????????CodeWizard?????VC++?????????????????VC++????CodeWizard????????

????1.2 ?????鶴?? PC-Lint

????PC-Lint????????????????????PC-Lint???100???C???????м?飬?????????C/C++?????е?1 000??????????????PC-lint??Visual Studio??????????????????á?Jon Zyzyck??????????????????????????????????????????http??//www.ddj.com?????????[4]??????????VC++?????м???PC-Lint??

????2??????????????????????????????????????????????

??????????????????????????????????????????????????????λ??????????????????????????????????????????????????Ч?????????

????2.1 ?????????籩???????

???????????????????????????????????е????????????????????檔????????????????????????????????????????????? ?????μ?????????????????????????????????????

??????1?????????????/д???????????????????????????????????????????????/д?? ???????assert??p??= NULL??????????? ???????????????????????????????????/д??檔Win32 API???????IsBadReadPtr??IsBadWritePtr??IsBadStringPtr??IsBadCodePtr??????????????????????????/д??C???????????_CrtIs ValidPointer??_CrtIsValidHeapPointer???????MFC??????AfxIsValidAddress??AfxIsValidString?????????????????

??????2???????MFC?????ASSERT_VALID??????????????AssertValid????????????CObject??????????????????Ч??ASSERT_VALID???????????AfxIsValidAddress??????CObject??????????AssertValid???????ο?MFC?????afx.h??objcore.cpp????