[ Pobierz całość w formacie PDF ]
.resumptionThe exception specificationunexpected( )set_unexpected( )Better exception specifications?Catching any exceptionRethrowing an exceptionUncaught exceptionsterminate( )set_terminate( )Function-level try blocksCleaning upConstructorsMaking everything an objectException matchingStandard exceptionsProgramming with exceptionsWhen to avoid exceptionsNot for asynchronous eventsNot for ordinary error conditionsNot for flow-of-controlYou’re not forced to use exceptionsNew exceptions, old codeTypical uses of exceptionsAlways use exception specificationsStart with standard exceptionsNest your own exceptionsUse exception hierarchiesMultiple inheritanceCatch by reference, not by valueThrow exceptions in constructorsDon’t cause exceptions in destructorsAvoid naked pointersOverheadSummaryExercises8: Run-time type identificationThe “Shape” exampleWhat is RTTI?Two syntaxes for RTTISyntax specificstypeid( ) with built-in typesProducing the proper type nameNonpolymorphic typesCasting to intermediate levelsvoid pointersUsing RTTI with templatesReferencesExceptionsMultiple inheritanceSensible uses for RTTIRevisiting the trash recyclerMechanism & overhead of RTTICreating your own RTTIExplicit cast syntaxSummaryExercises9: Building stable systemsShared objects & reference countingReference-counted class hierarchiesFinding memory leaksThe canonical object & singly-rooted hierarchiesAn extended canonical formDesign by contractIntegrated unit testingDynamic aggregationExercises10: Design patternsThe pattern conceptThe singletonVariations on singletonClassifying patternsFeatures, idioms, patternsBasic complexity hidingFactories: encapsulating object creationPolymorphic factoriesAbstract factoriesVirtual constructorsBEDestructor operationCallbacksFunctor/CommandStrategyObserverThe “interface” idiomThe “inner class” idiomThe observer exampleMultiple dispatchingVisitor, a type of multiple dispatchingEfficiencyFlyweightThe compositeEvolving a design: the trash recyclerImproving the design“Make more objects”A pattern for prototyping creationTrash subclassesParsing Trash from an external fileRecycling with prototypingAbstracting usageApplying double dispatchingImplementing the double dispatchApplying the visitor patternMore coupling?RTTI considered harmful?SummaryExercises11: Tools & topicsThe code extractorDebuggingassert( )Trace macrosTrace fileAbstract base class for debuggingTracking new/delete & malloc/freeCGI programming in C++Encoding data for CGIThe CGI parserTesting the CGI parserUsing POSTHandling mailing listsMaintaining your listMailing to your listA general information-extraction CGI programParsing the data filesSummaryExercisesA: Recommended readingCGeneral C++My own list of booksDepth & dark cornersThe STLDesign PatternsB: EtcIndex
[ Pobierz całość w formacie PDF ]