资源描述:
《Effective C ;More Effective C 》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、EffectiveC++byScottMeyersBacktoDedicationContinuetoAcknowledgmentsPrefaceThisbookisadirectoutgrowthofmyexperiencesteachingC++toprofessionalprogrammers.I'vefoundthatmoststudents,afteraweekofintensiveinstruction,feelcomfortablewiththebasicconstructsofthelanguage,butthe
2、ytendtobelesssanguineabouttheirabilitytoputtheconstructstogetherinaneffectivemanner.Thusbeganmyattempttoformulateshort,specific,easy-to-rememberguidelinesforeffectivesoftwaredevelopmentinC++:asummaryofthethingsexperiencedC++programmersalmostalwaysdooralmostalwaysavoi
3、ddoing.Iwasoriginallyinterestedinrulesthatcouldbeenforcedbysomekindoflint-likeprogram.Tothatend,IledresearchintothedevelopmentoftoolstoexamineC++sourcecodeforviolationsofuser-specifiedconditions.1Unfortunately,theresearchendedbeforeacompleteprototypecouldbedeveloped.
4、Fortunately,severalcommercialC++-checkingproductsarenowavailable.(You'llfindanoverviewofsuchproductsinthearticleonstaticanalysistoolsbymeandMartinKlaus.)Thoughmyinitialinterestwasinprogrammingrulesthatcouldbeautomaticallyenforced,Isoonrealizedthelimitationsofthatappr
5、oach.ThemajorityofguidelinesusedbygoodC++programmersaretoodifficulttoformalizeorhavetoomanyimportantexceptionstobeblindlyenforcedbyaprogram.Iwasthusledtothenotionofsomethinglessprecisethanacomputerprogram,butstillmorefocusedandto-the-pointthanageneralC++textbook.Ther
6、esultyounowholdinyourhands:abookcontaining50specificsuggestionsonhowtoimproveyourC++programsanddesigns.Inthisbook,you'llfindadviceonwhatyoushoulddo,andwhy,andwhatyoushouldnotdo,andwhynot.Fundamentally,ofcourse,thewhysaremoreimportantthanthewhats,butit'salotmoreconven
7、ienttorefertoalistofguidelinesthantomemorizeatextbookortwo.UnlikemostbooksonC++,mypresentationhereisnotorganizedaroundparticularlanguagefeatures.Thatis,Idon'ttalkaboutconstructorsinoneplace,aboutvirtualfunctionsinanother,aboutinheritanceinathird,etc.Instead,eachdiscu
8、ssioninthebookistailoredtotheguidelineitaccompanies,andmycoverageofthevariousaspectsofaparticularlanguagefeaturemaybedispersedthrou