C Programming FAQs: Frequently Asked Questions
C Programming FAQs: Frequently Asked Questions
BUY ON AMAZON
Table of content
Part I: Preliminaries
Chapter 1. Introduction
FAQ 1.01 What is the purpose of this chapter?
FAQ 1.02 What are C FAQs?
FAQ 1.03 Who is the target audience for this book?
FAQ 1.04 Is this a book about C per se?
FAQ 1.05 Why do developers need a guidebook for C and OO technology?
FAQ 1.06 What kind of guidance is given in the answers to these FAQs?
FAQ 1.07 What is the electronic FAQ and why buy this book when the electronic FAQ is free?
FAQ 1.08 Why should you buy this edition if you already have a copy of the first edition?
FAQ 1.09 What conventions are used in this book?
Chapter 2. Basic C Syntax and Semantics
FAQ 2.01 What is the purpose of this chapter?
FAQ 2.02 What are the basics of main() ?
FAQ 2.03 What are the basics of functions?
FAQ 2.04 What are the basics of default parameters?
FAQ 2.05 What are the basics of local (auto) objects?
FAQ 2.06 What are the basics of constructing objects using explicit parameters?
FAQ 2.07 What are the basics of dynamically allocated (new) objects?
FAQ 2.08 What are the basics of local objects within inner scopes?
FAQ 2.09 What are the basics of passing objects by reference?
FAQ 2.10 What are the basics of passing objects by value?
FAQ 2.11 What are the basics of passing objects by pointer?
FAQ 2.12 What are the basics of stream output?
FAQ 2.13 What are the basics of stream input?
FAQ 2.14 What are the basics of using classes that contain overloaded operators?
FAQ 2.15 What are the basics of using container classes?
FAQ 2.16 What are the basics of creating class header files?
FAQ 2.17 What are the basics of defining a class?
FAQ 2.18 What are the basics of defining member functions?
FAQ 2.19 What are the basics of adding a constructor to a class?
FAQ 2.20 What are the basics of adding a destructor to a class?
FAQ 2.21 What are the basics of defining a class that contains a pointer to an object allocated from the heap?
FAQ 2.22 What are the basics of global objects?
FAQ 2.23 What are the basics of throwing and catching exceptions?
FAQ 2.24 What are the basics of inheritance and dynamic binding?
Chapter 3. Understanding the Management Perspective
FAQ 3.01 What is the purpose of this chapter?
FAQ 3.02 What is the core message of this chapter (and this book)?
FAQ 3.03 Why are the managers in charge rather than the developers who understand technology?
FAQ 3.04 How can someone manage something they don t understand?
FAQ 3.05 What is the most common mistake on C and OO projects?
FAQ 3.06 What s the Software Peter Principle ?
FAQ 3.07 Should an organization use OO on all its projects?
FAQ 3.08 Can OO be ignored until it goes away?
FAQ 3.09 What OO language is best?
FAQ 3.10 What is the right approach to processes and tools?
FAQ 3.11 What is the right approach with off-the-shelf class libraries and frameworks?
Chapter 4. The Architectural Perspective
FAQ 4.01 What is the purpose of this chapter?
FAQ 4.02 Why is software architecture important?
FAQ 4.03 What should the architecture be based on, the problem being solved or the problem domain?
FAQ 4.04 Should the software architecture be based on the policy of the problem?
FAQ 4.05 Do customers ever change their requirements?
FAQ 4.06 Are stable requirements desirable?
FAQ 4.07 What is the key to planning for change?
FAQ 4.08 What is a framework?
FAQ 4.09 What is the inversion of control exhibited by frameworks?
FAQ 4.10 What is an extensible, domain-specific framework?
FAQ 4.11 What characteristics make a framework extensible yet domain-specific?
FAQ 4.12 What happens if the domain analysis is incorrect?
FAQ 4.13 How much effort should be expended to support changethat is, how much is extensibility worth?
FAQ 4.14 How does an architect make the software architecture flexible?
FAQ 4.15 What is the secret to achieving reuse?
Part II: Object-Oriented Design
Chapter 5. Object-Oriented Fundamentals
FAQ 5.01 What is the purpose of this chapter?
FAQ 5.02 Why is the world adopting OO technology?
FAQ 5.03 What are some of the benefits of using C for OO programming?
FAQ 5.04 What are the fundamental concepts of object-oriented technology?
FAQ 5.05 Why are classes important?
FAQ 5.06 What is an object?
FAQ 5.07 What are the desirable qualities of an object?
FAQ 5.08 How are classes better than the three basic building blocks of procedural software?
FAQ 5.09 What is the purpose of composition?
FAQ 5.10 What is the purpose of inheritance?
FAQ 5.11 What are the advantages of polymorphism and dynamic binding?
FAQ 5.12 How does OO help produce flexible and extensible software?
FAQ 5.13 How can old code call new code?
FAQ 5.14 What is an abstraction and why is it important?
FAQ 5.15 Should abstractions be user-centric or developer-centric?
FAQ 5.16 What s the difference between encapsulation and abstraction?
FAQ 5.17 What are the consequences of encapsulating a bad abstraction?
FAQ 5.18 What s the value of separating interface from implementation?
FAQ 5.19 How can separating interface from implementation improve performance as well as flexibility?
FAQ 5.20 What is the best way to create a good interface to an abstraction?
FAQ 5.21 How are getset member functions related to poorly designed interfaces?
FAQ 5.22 Should there be a get and a set member function for each member datum?
FAQ 5.23 Is the real purpose of a class to export data?
FAQ 5.24 Should OO be viewed as data-centric?
Chapter 6. Specification of Observable Behavior
FAQ 6.01 What is the purpose of this chapter?
FAQ 6.02 Should users of a member function rely on what the code actually does or on the specification?
FAQ 6.03 What are the advantages of relying on the specification rather than the implementation?
FAQ 6.04 What are advertised requirements and advertised promises?
FAQ 6.05 How are the advertised requirements and advertised promises of the member functions specified?
FAQ 6.06 Why are changes feared in development organizations that don t use specification?
FAQ 6.07 How do developers determine if a proposed change will break existing code?
FAQ 6.08 What are the properties of a substitutable (backward compatible) change in a specification?
FAQ 6.09 How can it be shown that the implementation of a member function fulfills its specification?
FAQ 6.10 Is it possible to keep the specification synchronized with the code?
Chapter 7. Proper Inheritance
FAQ 7.01 What is proper inheritance?
FAQ 7.02 What are the benefits of proper inheritance?
FAQ 7.03 What is improper inheritance?
FAQ 7.04 Isn t the difference between proper and improper inheritance obvious?
FAQ 7.05 Is substitutability based on what the code does or what the specification promises the code will do?
FAQ 7.06 Is it proper to revoke (hide) an inherited public: member function?
FAQ 7.07 What is specialization?
FAQ 7.08 What do subsets have to do with proper inheritance?
Chapter 8. Detecting and Correcting Improper Inheritance
FAQ 8.01 Can improper inheritance wreck a project?
FAQ 8.02 What s the best way to learn how to avoid improper inheritance?
FAQ 8.03 Is intuition a reliable guide to understanding proper inheritance?
FAQ 8.04 Is an Ostrich a kind-of Bird ?
FAQ 8.05 Should an overridden virtual function throw an exception?
FAQ 8.06 Can an overridden virtual function be a no-op?
FAQ 8.07 Why does C make it so hard to fix the OstrichBird dilemma?
FAQ 8.08 Should Circle inherit from Ellipse ?
FAQ 8.09 What can be done about the asymmetric-circle dilemma?
FAQ 8.10 What is the one issue in these FAQs that doesn t seem to die?
FAQ 8.11 Should Stack inherit from List ?
FAQ 8.12 Is code reuse the main purpose of inheritance?
FAQ 8.13 Is container-of-thing a kind-of container-of-anything?
FAQ 8.14 Is bag-of-apple a kind-of bag-of-fruit, assuming bag-of-fruit allows the insertion of any kind-of fruit?
FAQ 8.15 Is parking-lot-for-cars a kind-of parking-lot-for-arbitrary-vehicles (assuming parking-lot-for-vehicles allows parking any kind-of vehicle)?
FAQ 8.16 Is array-of Derived a kind-of array-of Base ?
FAQ 8.17 Does the fact that an array-of Derived can be passed as an array-of Base mean that arrays are bad?
Chapter 9. Error Handling Strategies
FAQ 9.01 Is error handling a major source of fundamental mistakes?
FAQ 9.02 How should runtime errors be handled in C?
FAQ 9.03 What happens to objects in stack frames that become unwound during the throw catch process?
FAQ 9.04 What is an exception specification?
FAQ 9.05 What are the disadvantages of using return codes for error handling?
FAQ 9.06 What are the advantages of throw ... catch ?
FAQ 9.07 Why is it helpful to separate normal logic from exception handling logic?
FAQ 9.08 What is the hardest part of using exception handling?
FAQ 9.09 When should a function throw an exception?
FAQ 9.10 What is the best approach for the hierarchy of exception objects?
FAQ 9.11 How should exception classes be named?
FAQ 9.12 Where do setjmp and longjmp belong in C?
Chapter 10. Testing Strategies
FAQ 10.01 What is the purpose of this chapter?
FAQ 10.02 What are the advantages of self-testing objects?
FAQ 10.03 What are some common excuses people use for not building self-testing into their objects?
FAQ 10.04 What will happen if techniques like those presented here are not used?
FAQ 10.05 When is a class correct?
FAQ 10.06 What is behavioral self-testing?
FAQ 10.07 What is a class invariant?
FAQ 10.08 Why should the invariant be captured explicitly?
FAQ 10.09 When should the testInvariant() member function be called?
FAQ 10.10 What can be done to ensure that an object doesn t get blown away by a wild pointer?
Part III: Language Facilities
Chapter 11. References
FAQ 11.01 What is a reference?
FAQ 11.02 What does referent mean?
FAQ 11.03 When can a reference be attached to its referent?
FAQ 11.04 What happens when a value is assigned to a reference?
FAQ 11.05 What is a local reference?
FAQ 11.06 What does it mean to return a reference?
FAQ 11.07 What is the result of taking the address of a reference?
FAQ 11.08 Can a reference be made to refer to a different referent?
FAQ 11.09 Why use references when pointers can do everything references can do?
FAQ 11.10 Aren t references just pointers in disguise?
FAQ 11.11 When are pointers needed?
FAQ 11.12 Why do some people hate references?
FAQ 11.13 Does int const x make sense?
Chapter 12. New and Delete
FAQ 12.01 Does new do more than allocate memory?
FAQ 12.02 Why is new better than good old trustworthy malloc() ?
FAQ 12.03 Does C have a counterpart to realloc() that goes along with new and delete ?
FAQ 12.04 Can pointers returned from new be deallocated with free() ? Can pointers returned from malloc() be deallocated with delete ?
FAQ 12.05 Does delete p delete the pointer p or the referent p ?
FAQ 12.06 Should the pointer returned from new Fred() be checked to see if it is NULL ?
FAQ 12.07 How can new be convinced to return NULL rather than throw an exception?
FAQ 12.08 How can new be set up to automatically flush pools of recycled objects whenever memory runs low?
FAQ 12.09 What happens if delete p is called when p is NULL ?
FAQ 12.10 What happens when a pointer is deleted twice?
FAQ 12.11 How can an array of things be allocated and deallocated?
FAQ 12.12 What if delete p (not delete p ) is used to delete an array allocated via new Fredn ?
FAQ 12.13 Can the of delete p be dropped when p points to an array of some built-in type such as char ?
FAQ 12.14 How is an object constructed at a predetermined position in memory?
FAQ 12.15 How can class Fred guarantee that Fred objects are created only with new and not on the stack?
FAQ 12.16 How are objects created by placement new destroyed?
FAQ 12.17 In pnew Fred() , does the Fred memory leak if the Fred constructor throws an exception?
FAQ 12.18 Is it legal (and moral) for a member function to say delete this ?
FAQ 12.19 After pnew Fredn , how does the compiler know that there are n objects to be destructed during delete p ?
Chapter 13. Inline Functions
FAQ 13.01 What is the purpose of inline functions?
FAQ 13.02 What is the connection between the keyword inline and inlined functions?
FAQ 13.03 Are there any special rules about inlining?
FAQ 13.04 What is the one-definition rule (ODR)?
FAQ 13.05 What are some performance considerations with inline functions?
FAQ 13.06 Do inlined functions improve performance?
FAQ 13.07 Do inlined functions increase the size of the executable code?
FAQ 13.08 Why shouldn t the inlining decision be made when the code is first written?
FAQ 13.09 What happens when a programmer uses an inlined function obtained from a third party?
FAQ 13.10 Is there an easy way to swap between inline and non- inline code?
Chapter 14. Const Correctness
FAQ 14.01 How should pointer declarations be read?
FAQ 14.02 How can C programmers avoid making unexpected changes to objects?
FAQ 14.03 Does const imply runtime overhead?
FAQ 14.04 Does const allow the compiler to generate more efficient code?
FAQ 14.05 Is const correctness tedious?
FAQ 14.06 Why should const correctness be done sooner rather than later?
FAQ 14.07 What s the difference between an inspector and a mutator?
FAQ 14.08 When should a member function be declared as const ?
FAQ 14.09 Does const apply to the object s bitwise state or its abstract state?
FAQ 14.10 When should const not be used in declaring formal parameters?
FAQ 14.11 When should const not be used in declaring a function return type?
FAQ 14.12 How can a nonobservable data member be updated within a const member function?
FAQ 14.13 Can an object legally be changed even though there is a const reference (pointer) to it?
FAQ 14.14 Does const_cast mean lost optimization opportunities?
Chapter 15. Namespaces
FAQ 15.01 What is the purpose of this chapter?
FAQ 15.02 What is a namespace?
FAQ 15.03 How can code outside a namespace use names declared within that namespace?
FAQ 15.04 What happens if two namespaces contain the same name?
FAQ 15.05 What are some of the rules for using namespaces?
FAQ 15.06 What is name lookup?
FAQ 15.07 What are the tradeoffs between the various techniques for using names from a namespace, particularly the standard namespace?
FAQ 15.08 Can namespaces break code?
FAQ 15.09 Do namespaces have any other applications?
FAQ 15.10 How do namespaces solve the problem of long identifiers?
Chapter 16. Using Static
FAQ 16.01 What is the purpose of this chapter?
FAQ 16.02 What are static class members?
FAQ 16.03 What is an analogy for static data members?
FAQ 16.04 Can inline functions safely access static data members?
FAQ 16.05 What is an analogy for static member functions?
FAQ 16.06 How is a static data member similar to a global variable?
FAQ 16.07 How is a static member function similar to a friend function?
FAQ 16.08 What is the named constructor idiom?
FAQ 16.09 How should static member functions be called?
FAQ 16.10 Why might a class with static data members get linker errors?
FAQ 16.11 How is a const static data member initialized?
FAQ 16.12 What is the right strategy for implementing a function that needs to maintain state between calls?
FAQ 16.13 How can the function call operator help with functionoids?
FAQ 16.14 Is it safe to be ignorant of the static initialization order problem?
FAQ 16.15 What is a simple and robust solution to the static initialization order problem?
FAQ 16.16 What if the static object s destructor has important side effects that must eventually occur?
FAQ 16.17 What if the static object s destructor has important side effects that must eventually occur and the static object must be accessed by another static object s destructor?
FAQ 16.18 What are some criteria for choosing between all these various techniques?
Chapter 17. Derived Classes
FAQ 17.01 What is the purpose of this chapter?
FAQ 17.02 How does C express inheritance?
FAQ 17.03 What is a concrete derived class?
FAQ 17.04 Why can t a derived class access the private: members of its base class?
FAQ 17.05 How can a base class protect derived classes so that changes to the base class will not affect them?
FAQ 17.06 Can a derived class pointer be converted into a pointer to its public base class?
FAQ 17.07 How can a class Y be a kind-of another class X as well as getting the bits of X ?
FAQ 17.08 How can a class Y get the bits of an existing class X without making Y a kind-of X ?
FAQ 17.09 How can a class Y be a kind-of another class X without inheriting the bits of X ?
Chapter 18. Access Control
FAQ 18.01 What is the purpose of this chapter?
FAQ 18.02 How are private: , protected: , and public: different?
FAQ 18.03 Why can t subclasses access the private: parts of their base class?
FAQ 18.04 What s the difference between the keywords struct and class ?
FAQ 18.05 When should a data member be protected: rather than private: ?
FAQ 18.06 Why is private: the default access level for a class?
Chapter 19. Friend Classes and Friend Functions
FAQ 19.01 What is a friend?
FAQ 19.02 What s a good mental model for friend classes?
FAQ 19.03 What are some advantages of using friend classes?
FAQ 19.04 Do friends violate the encapsulation barrier?
FAQ 19.05 What is a friend function?
FAQ 19.06 When should a function be implemented as a friend function rather than a member function?
FAQ 19.07 What are some guidelines to make sure friend functions are used properly?
FAQ 19.08 What does it mean that friendship isn t transitive?
FAQ 19.09 What does it mean that friendship isn t inherited?
FAQ 19.10 What does it mean that friends aren t virtual?
FAQ 19.11 What qualities suggest a friend function rather than a member function?
FAQ 19.12 Should friend functions be declared in the private: , protected: , or public: section of a class?
FAQ 19.13 What is a private class?
FAQ 19.14 How are objects of a class printed?
FAQ 19.15 How do objects of a class receive stream input?
Chapter 20. Constructors and Destructors
FAQ 20.01 What is the purpose of a constructor?
FAQ 20.02 What is C s constructor discipline?
FAQ 20.03 What is the purpose of a destructor?
FAQ 20.04 What is C s destructor discipline?
FAQ 20.05 What happens when a destructor is executed?
FAQ 20.06 What is the purpose of a copy constructor?
FAQ 20.07 When is a copy constructor invoked?
FAQ 20.08 What is the default constructor ?
FAQ 20.09 Should one constructor call another constructor as a primitive?
FAQ 20.10 Does the destructor for a derived class need to explicitly call the destructor of its base class?
FAQ 20.11 How can a local object be destructed before the end of its function?
FAQ 20.12 What is a good way to provide intuitive, multiple constructors for a class?
FAQ 20.13 When the constructor of a base class calls a virtual function, why isn t the override called?
FAQ 20.14 When a base class destructor calls a virtual function, why isn t the override called?
FAQ 20.15 What is the purpose of placement new ?
Chapter 21. Virtual Functions
FAQ 21.01 What is the purpose of this chapter?
FAQ 21.02 What is a virtual member function?
FAQ 21.03 How much does it cost to call a virtual function compared to calling a normal function?
FAQ 21.04 How does C perform static typing while supporting dynamic binding?
FAQ 21.05 Can destructors be virtual?
FAQ 21.06 What is the purpose of a virtual destructor?
FAQ 21.07 What is a virtual constructor?
FAQ 21.08 What syntax should be used when a constructor or destructor calls a virtual function in its object?
FAQ 21.09 Should the scope operator :: be used when invoking virtual member functions?
FAQ 21.10 What is a pure virtual member function?
FAQ 21.11 Can a pure virtual function be defined in the same class that declares it?
FAQ 21.12 How should a virtual destructor be defined when it has no code?
FAQ 21.13 Can an ABC have a pure virtual destructor?
FAQ 21.14 How can the compiler be kept from generating duplicate outlined copies of inline virtual functions?
FAQ 21.15 Should a class with virtual functions have at least one non-inline virtual function?
Chapter 22. Initialization Lists
FAQ 22.01 What are constructor initialization lists?
FAQ 22.02 What will happen if constructor initialization lists are not used?
FAQ 22.03 What s the guideline for using initialization lists in constructor definitions?
FAQ 22.04 Is it normal for constructors to have nothing inside their body?
FAQ 22.05 How is a const data member initialized?
FAQ 22.06 How is a reference data member initialized?
FAQ 22.07 Are initializers executed in the same order in which they appear in the initialization list?
FAQ 22.08 How should initializers be ordered in a constructor s initialization list?
FAQ 22.09 Is it moral for one member object to be initialized using another member object in the constructor s initialization list?
FAQ 22.10 What if one member object has to be initialized using another member object?
FAQ 22.11 Are there exceptions to the rule Initialize all member objects in an initialization list ?
FAQ 22.12 How can an array of objects be initialized with specific initializers?
Chapter 23. Operator Overloading
FAQ 23.01 Are overloaded operators like normal functions?
FAQ 23.02 When should operator overloading be used?
FAQ 23.03 What operators can t be overloaded?
FAQ 23.04 Is the goal of operator overloading to make the class easier to understand?
FAQ 23.05 Why do subscript operators usually come in pairs?
FAQ 23.06 What is the most important consideration for operators such as , , and ?
FAQ 23.07 How are the prefix and postfix versions of operator distinguished?
FAQ 23.08 What should the prefix and postfix versions of operator return?
FAQ 23.09 How can a Matrix -like class have a subscript operator that takes more than one subscript?
FAQ 23.10 Can a operator serve as an exponentiation operator?
Chapter 24. Assignment Operators
FAQ 24.01 What should assignment operators return?
FAQ 24.02 What is wrong with an object being assigned to itself?
FAQ 24.03 What should be done about self-assignment?
FAQ 24.04 Should an assignment operator throw an exception after partially assigning an object?
FAQ 24.05 How should the assignment operator be declared in an ABC?
FAQ 24.06 When should a user-defined assignment operator mimic the assignment operator that the compiler would generate automatically?
FAQ 24.07 What should be returned by private: and protected: assignment operators?
FAQ 24.08 Are there techniques that increase the likelihood that the compiler-synthesized assignment operator will be right?
FAQ 24.09 How should the assignment operator in a derived class behave?
FAQ 24.10 Can an ABC s assignment operator be virtual ?
FAQ 24.11 What should a derived class do if a base class s assignment operator is virtual ?
FAQ 24.12 Should the assignment operator be implemented by using placement new and the copy constructor?
Chapter 25. Templates
FAQ 25.01 What is the purpose of templates?
FAQ 25.02 What are the syntax and semantics for a class template?
FAQ 25.03 How can a template class be specialized to handle special cases?
FAQ 25.04 What are the syntax and semantics for a function template?
FAQ 25.05 Should a template use memcpy() to copy objects of its template argument?
FAQ 25.06 Why does the compiler complain about when one template is used inside another?
Chapter 26. Exception Tactics
FAQ 26.01 What belongs in a try block?
FAQ 26.02 When should a function catch an exception?
FAQ 26.03 Should a catch block fully recover from an error?
FAQ 26.04 How should a constructor handle a failure?
FAQ 26.05 What are zombie objects (and why should they be avoided)?
FAQ 26.06 What should an object do if one of its member objects could throw an exception during its constructor?
FAQ 26.07 Should destructors throw exceptions when they fail?
FAQ 26.08 Should destructors call routines that may throw exceptions?
FAQ 26.09 Should resource deallocation primitives signal failure by throwing an exception?
FAQ 26.10 What should the terminate() function do?
FAQ 26.11 What should the unexpected() function do?
FAQ 26.12 Under what circumstances can an overridden virtual member function throw exceptions other than those listed by the specification of the member function in the base class?
FAQ 26.13 How might the exception-handling mechanism cause a program to silently crash?
Chapter 27. Types and RTTI
FAQ 27.01 What is the purpose of this chapter?
FAQ 27.02 What is static type checking?
FAQ 27.03 What is dynamic type checking?
FAQ 27.04 What is the basic problem with dynamic type checking?
FAQ 27.05 How can dynamic type checking be avoided?
FAQ 27.06 Are there better alternatives to dynamic type checking?
FAQ 27.07 What is a capability query?
FAQ 27.08 What is an alternative to dynamic type checking with containers?
FAQ 27.09 Are there cases where dynamic type checking is necessary?
FAQ 27.10 Given a pointer to an ABC, how can the class of the referent be found?
FAQ 27.11 What is a downcast?
FAQ 27.12 What is an alternative to using downcasts?
FAQ 27.13 Why are downcasts dangerous?
FAQ 27.14 Should the inheritance graph of C hierarchies be tall or short?
FAQ 27.15 Should the inheritance graph of C hierarchies be monolithic or a forest?
FAQ 27.16 What is Runtime Type Identification (RTTI)?
FAQ 27.17 What is the purpose of dynamic_castT() ?
FAQ 27.18 Is dynamic_castT() a panacea?
FAQ 27.19 What does static_castT() do?
FAQ 27.20 What does typeid() do?
FAQ 27.21 Are there any hidden costs for type-safe downcasts?
Chapter 28. Containers
FAQ 28.01 What are container classes and what are the most common mistakes made with container classes?
FAQ 28.02 Are arrays good or evil?
FAQ 28.03 Should application development organizations create their own container classes?
FAQ 28.04 What are some common mistakes with containers of pointers?
FAQ 28.05 Does this mean that containers of pointers should be avoided?
FAQ 28.06 Surely good old-fashioned char is an exception, right?
FAQ 28.07 Can auto_ptrT simplify ownership problems with containers of pointers?
FAQ 28.08 Can a Java-like Object class simplify containers in C?
FAQ 28.09 What s the difference between a homogeneous and a heterogeneous container?
FAQ 28.10 Is it a good idea to use a best of breed approach when selecting container classes?
FAQ 28.11 Should all projects use C s standardized containers?
FAQ 28.12 What are the C standardized container classes?
FAQ 28.13 What are the best applications for the standardized C sequence container classes?
FAQ 28.14 What are the best situations for the standardized C associative container classes?
Part IV: Topics
Chapter 29. Mixing Overloading with Inheritance
FAQ 29.01 What is the difference between overloaded functions and overridden functions?
FAQ 29.02 What is the hiding rule?
FAQ 29.03 How should the hiding rule be handled?
FAQ 29.04 What should a derived class do when it redefines some but not all of a set of overloaded member functions inherited from the base class?
FAQ 29.05 Can virtual functions be overloaded?
Chapter 30. The Big Three
FAQ 30.01 What is the purpose of this chapter?
FAQ 30.02 What are the Big Three?
FAQ 30.03 What happens when an object is destroyed that doesn t have an explicit destructor?
FAQ 30.04 What happens if an object is copied but doesn t have an explicit copy constructor?
FAQ 30.05 What happens when an object that doesn t have an explicit assignment operator is assigned?
FAQ 30.06 What is the Law of the Big Three?
FAQ 30.07 Which of the Big Three usually shows up first?
FAQ 30.08 What is remote ownership?
FAQ 30.09 How is remote ownership special?
FAQ 30.10 What if a class owns a referent and doesn t have all of the Big Three?
FAQ 30.11 Are there any C classes that help manage remote ownership?
FAQ 30.12 Does auto_ptr enforce the Law of the Big Three and solve the problems associated with remote ownership?
FAQ 30.13 Are there cases where one or two of the Big Three may be needed but not all three?
FAQ 30.14 Are there any other circumstances that might explicitly warrant the Big Three?
FAQ 30.15 Why does copying an object using memcpy() cause a program crash?
FAQ 30.16 Why do programs with variable-length argument lists crash?
FAQ 30.17 Why do programs that use realloc() to reallocate an array of objects crash?
Chapter 31. Using Objects to Prevent Memory Leaks
FAQ 31.01 When are memory leaks important?
FAQ 31.02 What is the easiest way to avoid memory leaks?
FAQ 31.03 What are the most important principles for resource management?
FAQ 31.04 Should the object that manages a resource also perform operations that may throw exceptions?
FAQ 31.05 Should an object manage two or more resources?
FAQ 31.06 What if an object has a pointer to an allocation and one of the object s member functions delete s the allocation?
FAQ 31.07 How should a pointer variable be handled after being passed to delete ?
FAQ 31.08 What should be done with a pointer to an object that is allocated and deallocated in the same scope?
FAQ 31.09 How easy is it to implement reference counting with pointer semantics?
FAQ 31.10 Is reference counting with copy-on-write semantics hard to implement?
FAQ 31.11 How can reference counting be implemented with copy-on-write semantics for a hierarchy of classes?
Chapter 32. Wild Pointers and Other Devilish Errors
FAQ 32.01 What is a wild pointer?
FAQ 32.02 What happens to a program that has even one wild pointer?
FAQ 32.03 What does the compiler mean by the warning Returning a reference to a local object ?
FAQ 32.04 How should pointers across block boundaries be controlled?
FAQ 32.05 Is the reference-versus-pointer issue influenced by whether or not the object is allocated from the heap?
FAQ 32.06 When should C-style pointer casts be used?
FAQ 32.07 Is it safe to bind a reference variable to a temporary object?
FAQ 32.08 Should a parameter passed by const reference be returned by const reference?
FAQ 32.09 Should template functions for things like min(x,y) or abs(x) return a const reference?
FAQ 32.10 When is zero not necessarily zero?
Chapter 33. High-Performance Software
FAQ 33.01 Is bad performance a result of bad design or bad coding?
FAQ 33.02 What are some techniques for improving performance?
FAQ 33.03 What is an advantage of using pointers and references?
FAQ 33.04 What is a disadvantage of lots of references and pointers?
FAQ 33.05 How else can member objects improve performance over pointers?
FAQ 33.06 Which is better, i or i ?
FAQ 33.07 What is the performance difference between Fred x(5)
FAQ 33.08 What kinds of applications should consider using final classes and final member functions?
FAQ 33.09 What is a final class?
FAQ 33.10 What is a final member function?
FAQ 33.11 How can final classes and final member functions improve performance?
FAQ 33.12 When should a nonfinal virtual function be invoked with a fully qualified name?
FAQ 33.13 Should full qualification be used when calling another member function of the same class?
FAQ 33.14 Do final classes and final member functions cause a lot of code duplication?
FAQ 33.15 Why do some developers dislike final member functions and final classes?
FAQ 33.16 Can a programming languagerather than just the compileraffect the performance of software?
Chapter 34. COM and ActiveX
FAQ 34.01 Who should read this chapter?
FAQ 34.02 What is the Component Object Model?
FAQ 34.03 What are ActiveX and OLE?
FAQ 34.04 What does the name Component Object Model mean?
FAQ 34.05 What is a binary object model ?
FAQ 34.06 What are the key features of COM?
FAQ 34.07 What are GUIDs?
FAQ 34.08 Why does COM need GUIDs (and CLSIDs and IIDs)?
FAQ 34.09 What is an interface?
FAQ 34.10 What is the IUnknown interface?
FAQ 34.11 How many ways are there to specify COM interfaces?
FAQ 34.12 What are COM classes and COM objects?
FAQ 34.13 How hard is it for callers to create and use a COM object?
FAQ 34.14 How does COM provide language transparency?
FAQ 34.15 How does COM provide location transparency?
FAQ 34.16 What types of errors occur due to reference counting?
FAQ 34.17 What mechanism does COM define for error handling?
FAQ 34.18 How are interfaces versioned?
FAQ 34.19 Is COM object oriented?
FAQ 34.20 What is the biggest problem with COM?
FAQ 34.21 What are the major differences between COM and C?
FAQ 34.22 When should a class be defined as a COM class?
FAQ 34.23 What is Automation?
FAQ 34.24 What are dispatch interfaces?
FAQ 34.25 When should a class expose a Dispatch interface?
FAQ 34.26 How does Automation work?
FAQ 34.27 How does Invoke accomplish all of this?
FAQ 34.28 What is a type library?
FAQ 34.29 What are the benefits of using type libraries?
FAQ 34.30 How do type libraries improve performance?
FAQ 34.31 What are dual interfaces?
FAQ 34.32 What limitations are there on dual interfaces?
FAQ 34.33 What are OLE custom controls and ActiveX controls?
FAQ 34.34 Why do ActiveX controls differ from OLE custom controls?
FAQ 34.35 What is a control container?
FAQ 34.36 What are component categories?
FAQ 34.37 What are events?
FAQ 34.38 What is DCOM?
FAQ 34.39 How stable is DCOM s infrastructure?
FAQ 34.40 What is COM?
Chapter 35. Transitioning to CORBA
FAQ 35.01 What is CORBA?
FAQ 35.02 What is an ORB?
FAQ 35.03 What is IDL?
FAQ 35.04 What is COS?
FAQ 35.05 What is OMA?
FAQ 35.06 What is OMG?
FAQ 35.07 What is the purpose of this chapter?
FAQ 35.08 What is the most important message of this chapter?
FAQ 35.09 What are the important concepts behind CORBA?
FAQ 35.10 Isn t OMG IDL pretty much the same as C?
FAQ 35.11 Is the lifecycle of a CORBA object the same as the life cycle of a C object?
FAQ 35.12 Is the C code that interacts with the CORBA implementation portable to a different CORBA vendor?
FAQ 35.13 How do CORBA exceptions compare to C exceptions?
FAQ 35.14 Which CORBA implementation is best? Is CORBA better than COM?
Chapter 36. C Language Considerations
FAQ 36.01 What are the main issues when mixing C and C code in the same application?
FAQ 36.02 How can C code call C code?
FAQ 36.03 How can C code call C code?
FAQ 36.04 Why is the linker giving errors for C functions called from C functions and vice versa?
FAQ 36.05 How can an object of a C class be passed to or from a C function?
FAQ 36.06 Can a C function directly access data in an object of a C class?
FAQ 36.07 Can C IO ( iostream ) be mixed with C IO ( stdio.h )?
FAQ 36.08 Which is safer: iostream or stdio.h ?
FAQ 36.09 Which is more extensible: iostream or stdio.h ?
FAQ 36.10 Which is more flexible: iostream or stdio.h ?
FAQ 36.11 Why does it seem that C programming feels farther away from the machine than C?
FAQ 36.12 Why does C do more things behind your back than C does?
Chapter 37. Private and Protected Inheritance
FAQ 37.01 What are private inheritance and protected inheritance?
FAQ 37.02 What is the difference between private inheritance and protected inheritance?
FAQ 37.03 What is the syntax and semantics for private and protected inheritance?
FAQ 37.04 When should normal has-a be used, rather than private or protected inheritance?
FAQ 37.05 What are the access rules for public, protected, and private inheritance?
FAQ 37.06 In a private or protected derived class, how can a member function that was public in the base class be made public in the derived class?
FAQ 37.07 Should a pointer be cast from a private or protected derived class to its base class?
Chapter 38. Pointers to Member Functions
FAQ 38.01 What is the type of a pointer to a nonstatic member function?
FAQ 38.02 Can pointers to nonstatic member functions be passed to signal handlers, X event call-back handlers, and so on, that expect C-like function pointers?
FAQ 38.03 What is one of the most common errors when using pointers to member functions?
FAQ 38.04 How is an array of pointers to nonstatic member functions declared?
Chapter 39. The Transition to OO and C
FAQ 39.01 Who should read this chapter?
FAQ 39.02 What are the key messages of this chapter?
FAQ 39.03 How many stages of technical expertise are there in the transition?
FAQ 39.04 Why bother defining levels of expertise?
FAQ 39.05 Can OOC be learned from a book?
FAQ 39.06 Can OOC be learned from a course?
FAQ 39.07 What is the key to learning OOC?
FAQ 39.08 Are small projects a good way to get your feet wet?
FAQ 39.09 Does being a good C programmer help when learning OOC?
FAQ 39.10 What skills help when learning OOC?
C Programming FAQs: Frequently Asked Questions
BUY ON AMAZON
Similar book on Amazon
Documenting Software Architectures: Views and Beyond
The C Puzzle Book
Expert C Programming
C Programming Language (2nd Edition)
C Traps and Pitfalls
Database Modeling with MicrosoftВ® Visio for Enterprise Architects (The Morgan Kaufmann Series in Data Management Systems)
Project Management JumpStart
Building the Foundation
Defining the Project Goals
Planning and Acquiring Resources
Appendix A Answers to Review Questions
Appendix C Sample Project Management Checklists
Building Web Applications with UML (2nd Edition)
Software Architecture Document
C++ How to Program (5th Edition)
Simple HTTP Transactions
E.13. Linkage Specifications
F.3. The #define Preprocessor Directive: Symbolic Constants
Logistics and Retail Management: Emerging Issues and New Challenges in the Retail Supply Chain
Logistics in Tesco: Past, Present and Future
Temperature-Controlled Supply Chains
Rethinking Efficient Replenishment in the Grocery Sector
The Development of E-tail Logistics
Enterprise Resource Planning (ERP) Systems: Issues in Implementation
After Effects and Photoshop: Animation and Production Effects for DV and Film, Second Edition
Blue-Screen Garbage Mattes
Making Movies from Stills
Color, Light, and Focus
Atmosphere, Film, and Noise Effects
Custom Scene Transitions
HTI+ Home Technology Integrator & CEDIA Installer I All-In-One Exam Guide
Troubleshooting Structured Wiring
Troubleshooting Audio Systems
Appendix E CEDIA Installer Level I Classification System
flylib.com © 2008-2017.
If you may any questions please contact us: firstname.lastname@example.org
to find out more.