3.9 Key Point Summary
C++ functions have definitions and declarations. Function prototypes must always precede function calls.
Inline functions give you the type safety of functions with the performance of macros.
Recursive functions make extensive use of the run-time stack but are often simple and elegant solutions to complex problems.
Pointers to functions allow you to call functions through data structures, such as dispatch tables.
With function prototypes and definitions, all sizes of a multidimensional array argument are necessary except the first one. All sizes must be constant integer expressions, and the first size is optional.
Function signatures with default arguments obey the Positional Rule: arguments without default values must appear to the left of all default arguments.
The Standard Args technique with <stdarg.h> lets you design functions that accept a variable number of arguments.
Structures encapsulate data members and functions. Structures may nest, and structure copy and assignment is legal between structures of the same type.
Unions are like structures, except they allocate only enough memory to accommodate the largest data member. Unions may be anonymous.
References may appear in function signatures and function return values. References give you the efficiency of pointers without pointer notation. References with structures and unions eliminate structure copy and assignment.
The C++ keywords auto, static, register, extern, and mutable are storage class specifiers. Automatic variables do not retain their values between function calls, but static variables do. Register variables improve performance, and externals provide access of variables between modules. The mutable keyword allows constant member functions to modify data members of constant structures.
The keywords try, catch, and throw implement exception handling. Exception specifications document which, if any, exceptions a function may throw.
Namespace definitions divide global namespace into distinct parts. Each namespace defines a named scope, allowing names (variables, structures, enums, functions, classes, and typedefs) to exist outside local scope without polluting the global namespace.
Namespace using directives and using declarations provide easy access to namespace members. Namespace aliases provide shorter names for longer namespace qualifiers.
Operator new allocates memory from free store dynamically, and operator delete releases memory. Operator new throws standard exception bad_alloc when it fails to allocate free store memory.
Operator new allocates one object or an array of objects, which can be pointer arrays or multidimensional arrays. Operator delete lets you release one object or an array of objects in free store.