资源描述:
《Effective C 》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、EffectiveC++,2E
2、ShiftingfromCtoC++Page1of191EffectiveC++EffectiveC++EffectiveC++byScottMeyersBacktoDedication ContinuetoAcknowledgmentsPrefaceThisbookisadirectoutgrowthofmyexperiencesteachingC++toprofessionalprogrammers.I'vefoundthatmoststudents,afteraweekofintensiveinstruction,feelc
3、omfortablewiththebasicconstructsofthelanguage,buttheytendtobelesssanguineabouttheirabilitytoputtheconstructstogetherinaneffectivemanner.Thusbeganmyattempttoformulateshort,specific,easy-to-rememberguidelinesforeffectivesoftwaredevelopmentinC++:asummaryofthethingsexperiencedC++programme
4、rsalmostalwaysdooralmostalwaysavoiddoing.Iwasoriginallyinterestedinrulesthatcouldbeenforcedbysomekindoflint-likeprogram.Tothatend,Iled1researchintothedevelopmentoftoolstoexamineC++sourcecodeforviolationsofuser-specifiedconditions.Unfortunately,theresearchendedbeforeacompleteprototypec
5、ouldbedeveloped.Fortunately,severalcommercialC++-checkingproductsarenowavailable.(You'llfindanoverviewofsuchproductsinthearticleonstaticanalysistoolsbymeandMartinKlaus.)file://C:DocumentsandSettingsxaiLocalSettingsTemp~hh9D37.htm11/5/2009EffectiveC++,2E
6、ShiftingfromCtoC++Page2of1
7、91Thoughmyinitialinterestwasinprogrammingrulesthatcouldbeautomaticallyenforced,Isoonrealizedthelimitationsofthatapproach.ThemajorityofguidelinesusedbygoodC++programmersaretoodifficulttoformalizeorhavetoomanyimportantexceptionstobeblindlyenforcedbyaprogram.Iwasthusledtothenotionofsomet
8、hinglessprecisethanacomputerprogram,butstillmorefocusedandto-the-pointthanageneralC++textbook.Theresultyounowholdinyourhands:abookcontaining50specificsuggestionsonhowtoimproveyourC++programsanddesigns.Inthisbook,you'llfindadviceonwhatyoushoulddo,andwhy,andwhatyoushouldnotdo,andwhynot.
9、Fundamentally,ofcourse,thewhysaremoreimportantthanthewhats,butit'salotmoreconvenienttorefertoalistofguidelinesthantomemorizeatextbookortwo.UnlikemostbooksonC++,mypresentationhereisnotorganizedaroundparticularlanguagefeatures.Thatis,Idon'ttalkaboutconstructorsinoneplace,aboutvirtualfun
10、ction