7.5.  Review Questions

[ fromfile: libraries-questions.xml id: libraries-questions ]

  1. What is a platform? What platform do you use? What platform can be found in the labs at your school or work place?

  2. What is code reuse? How is it done? What is good about it?

  3. What is the role of a compiler?

  4. What is the role of a linker?

  5. Name three kinds of C++ libraries.

  6. What is CPPLIBS? Why do you need it?

  7. For each of these items, decide whether it would normally be found in a header (.h) file or an implementation (.cpp) file and explain why.

    1. Function definitions

        implementation - they should be only compiled once, and not included by other modules that use it.

    2. Function declarations

        usually the header file, to refer to functions defined in other separate implementation files.

    3. static object declarations

        header files, like most declarations.

    4. static object definitions

        implementation file, just like functions. We do not wish to have redundant storage allocation for statics.

    5. Class definitions

        These go in the header file.

    6. Class declarations

        header file - usually they are forward declarations.

    7. inline function definitions

        header files - unlike regular functions which can be linked together, inline functions need to be fully defined before they can be used.

    8. inline function declarations

       Header file - Rarely used for member functions except when the declaration is separated from the definition - but kept in the same header file.

    9. Default argument specifiers

        header file - default arguments to a function changes the way the function is called. This is the realm of the header file.

  8. What is the difference between a compile time dependency and a link time dependency?

      A compile time dependency exists if we need to #include the header file in order to reuse the symbol. A link time dependency exists if we can get away with just a declaration of the symbol, which requires the linker to be able to find the referenced symbol.

  9. What is a framework? Are you using one?

  10. What is a design pattern? What do most design patterns have in common?

      Most design patterns describe how to separate code by responsibility. Each has a pattern name, a description of the problem to which the pattern applies, a description of how the pattern solves the problem, and a discussion of the consequences of employing the pattern.

  11. What is an AntiPattern?