Bjarne Stroustrup's C++ Glossary Flashcards
!=
the inequality operator; compares values for inequality returning a bool.
define
a directive that defines a macro.
include
a mechanism for textual inclusion of one source file into another. Typically used to compose a translation unit out of a .c file and the header files it needs to define its view if the rest of the program.
+=
add–and–assign operator; a+=b is roughly equivalent to a=a+b. Often a useful operation for user–defined types.
.c/.cpp/.cxx file
file containing definitions.
<<
- iostream output operator.
- integer left–shift operator.
=/assignment operator
the assignment operator; not an equality operator. = can be used for non-const built-in types (except arrays), enumerations, strings, containers, iterators, complex, and valarray. For a class, = is by default defined member-wise assignment; if necessary, the writer of a class can define it differently.
=0
curious notation indicating that a virtual function is a pure virtual function.
>>
- iostream input operator.
- integer right–shift operator.
==/equality operator
the equality operator; compares values for equality returning a bool. == can be used for built–in types, enumerations, strings, iterators, complex, and valarray. == is not by default defined for a class, but a user can define it for a user–defined type. Note that == doesn’t have the naively expected meaning for C–style strings or arrays.
abstract class/abstract type
a class defining an interface only; used as a base class. Declaring a member function pure virtual makes its class abstract and prevents creation of objects of the abstract class. Use of abstract classes is one of the most effective ways of minimizing the impact of changes in a C++ program and for minimizing compilation time.
abstraction
the act of specifying a general interface hiding implementation details. Classes, abstract classes, and templates are the primary abstraction mechanisms in C++. See also: encapsulation.
access control
access to bases and members of a class can be controlled by declaring them public, protected, or private.
adapter
a class that takes arguments producing a function object that performs an operation based on those arguments. A simple form of a higher–order function. For example, mem_fun() adapts a member function for use by the standard algorithms. See also: sequence adapter.
address
a memory location.
aggregate
an array or a struct without a constructor.
algorithm
a precise definition of a computation. The standard library provides about 60 standard algorithms, such as sort(), search(), and copy_unique().
alignment
placing objects in memory to suit hardware requirements. On many machines, an object must be aligned on a word boundary for acceptable performance.
allocator
object used by standard library containers to allocate and deallocate memory.
and
synonym for &&, the logical and operator.
application
a collection of programs seen as serving a common purpose (usually providing a common interface to their users).
argument
a value passed to a function or a template. In the case of templates, an argument is often a type.
argument passing
The semantics of function call is to pass a copy of an argument. The copy operation is defined by the argument type’s copy constructor or by binding to a reference. In either case the semantics is those of initialization.
argument–based lookup
lookup of a function name or operator based on the namespace of the arguments or operands. Often called Koenig lookup after Andrew Koenig who proposed the scheme to the standards committee.
array
contiguous sequence of elements. An array doesn’t know its own size; the programmer must take care to avoid range errors. Where possible use the standard library vector.
auto
In C and C++98 a largely useless keyword redundantly indicating stack allocation for local variables. In C++0x a keyword indicating that a variable gets its type from its initializer. For example: double d1 = 2; auto d2 = 3*d1; (d2 will have type double). Primarily useful in generic programming.
auto_ptr
standard library class template for representing ownership of an object in a way that guarantees proper release (delete) even when an exception is thrown. See also: resource management, resource acquisition is initialization.
back–end
the parts of a compiler that generates code given an internal representation of a correct program. This representation is produced by a compiler front–end. See also: front–end.
back_inserter()
returns an iterator that can be used to add elements at the back of a container.
bad_alloc
standard exception thrown by new in case of failure to allocate free store.
bad_cast
standard exception thrown if a dynamic_cast to a reference fails. TC++PL 15.4.1.1, D&E 14.2.2.
base class
a class from which another is derived. TC++PL 2.6.2, 12, 15, D&E 2.9.
base initializer
initializer for a base class specified in the constructor for a derived class. TC++PL 12.2.2, 15.2.4.1, D&E 12.9.
basic guarantee
the guarantee that basic invariants are maintained if an exception is thrown and that no resources are leaked/lost. Provided by all standard library operations. See also exception safety, nothrow guarantee, and strong guarantee. TC++PL E.2.
basic_string
general standard–library string template parameterized by character type. See also: string, C–style string. TC++PL 20.3.
binary operator
an operator taking two operands, such as /, &&, and binary *.
binder
a function taking a function and a value, returning a function object; when called, that function object will invoke the function with the value as an argument in addition to other arguments supplied in the call. The standard library provides bind1st() and bind2nd() for binding the first and second argument of a binary function, respectively. TC++PL 18.4.4.
bit
a unit of memory that can hold 0 or 1. An individual bit cannot be directly accessed in C++ (the unit of addressing is a byte), but a bit can be accessed through a bitfield or by using the bitwise logical operators & and |. TC++PL 6.2.4.
bitand
synonym for &, the bitwise and operator. TC++PL C.3.1.
bitfield
a number of bits in a word made accessible as a struct member. TC++PL C.8.1
bitor
synonym for |, the bitwise or operator TC++PL C.3.1.
bitset
a standard library almost container holding N bits and providing logical operations on those. TC++PL 17.5.3.
block
see compound statement. See also: try–block.
block comment
comment started by /* and terminated by */. TC++PL 6.4, D&E 3.11.1.
bool
the built–in Boolean type. A bool can have the values true and false. TC++PL 4.2, D&E 11.7.2.
boost.org
a collection of people
bug
colloquial term for error.
built–in type
A type provided directly by C++, such as int, double, and char*. See also: integral types, floating–point type, pointer, reference. TC++PL 4.1.1, 5.1, 5.2, 5.5, D&E 4.4, 15.11.3.
byte
a unit of memory that can hold a character of the C++ representation character set. The smallest unit of memory that can be directly addressed in C++. Usually, a byte is 8 bits. TC++PL 4.6.
C
programming language designed and originally implemented by Dennis Ritchie. C++ is based on C and maintains a high degree of compatibility with C. See also: K&R C, C89, C99, ANSI C. TC++PL B, D&E 3.12.
C standard library
the library defined for C in the C standard. Inherited by C++. Most C standard library functions have safer and more convenient alternatived in the C++ standard library. See also: algorithm, container, stream I/O, string, locale.
C++
a general–purpose programming language with a bias towards systems programming that supports procedural programming, data abstraction, object–oriented programming, and generic programming. C++ was designed and originally implemented by Bjarne Stroustrup. C++ is defined by ISO/IEC 14882
C++ standard
the definition of C++ provided by ISO. Available from ANSI; see my C++ page. TC++PL 1.4, B.1. D&E 6.1.
C++/CLI
A set of Microsoft extensions to C++ for use with their .Net system. See FAQ comments.
C–style cast
dangerous form of explicit type conversion; prefer new–style cast if you must use explicit type conversion. TC++PL 6.2.7, D&E 14.3.5.1.
C–style string
zero–terminated array of characters, supported by C standard library functions. A low–level and error–prone mechanism; where possible prefer strings. TC++PL 3.5.1, 20.3.7, 20.4.
C/C++
(1) an abbreviation used when discussing similarities, differences, and compatibility issues of C and C++. (2) a mythical language referred to by people who cannot or do not want to recognize the magnitude of differences between the facilities offered by C and C++ or the significant differences in the programming styles supported by the two language. See also: multi–paradigm programming, object–oriented programming, generic programming, exception, template, user–defined type, C++ standard library.
C/C++ compatibility
C++ was designed to be as compatible as possible to C, but no more. This basically means as compatible as can be without compromising C++’s level of type safety. You can download Appendix B of TC++PL,. Compatibility, which describes incompatibilities and differences in facilities offered by C and C++. TC++PL B. D&E 2.7, 3.12, 4.5.
call–by–reference
declaring a function argument type to be a reference, thus passing a reference rather than a value to the called function. See Also: call–by–value. TC++PL 5.5, D&E 3.7.
call–by–value
passing a copy of an argument to the called function. The semantics of function call is to pass a copy of an argument. The copy operation is defined by the argument type’s copy constructor. See Also: call–by–reference. TC++PL 7.2.
cast
operator for explicit type conversion; most often best avoided. See also dynamic_cast, C–style cast, new–style cast. TC++PL 6.2.7, D&E 7.2, 14.2.2.1.
catch
keyword used to introduce a catch–clause.
catch(…)
catch every exception. TC++PL 14.3.2, D&E 16.5.
catch–clause
a part of a try–block that handles exceptions of a specified type. Also called a handler or an exception handler. TC++PL 8.3.1, 14.3, D&E 16.3–4.
cerr
standard unbuffered ostream for error or diagnostic output. TC++PL 21.2.1.
Cfront
the front–end of Bjarne Stroustrup’s original C++ compiler. D&E 3.3.
char
character type; typically an 8–bit byte. See also: wchar_t. TC++PL 4.3, C.3.4.
char*
pointer to a char or an array of char. Typically assumed to point to a C–style string. Prefer a standard library string over a C–style string when you can. TC++PL 2.3.3, 13.5.2.
character set
a set of integer values with a mapping to character representations; for example, ASCII (ANSI13.4–1968) gives meaning to the values 0–127. ASCII is C++’s representation character set, the character set used to represent program source text. TC++PL C.3. D&E 6.5.3.
character type
char, unsigned char, and signed char. These are three distinct types. See also: wchar_t. TC++PL 2.3.1, 4.3, C.3.4.
cin
standard istream. TC++PL 3.6, 21.3.1 D&E 8.3.1.
class
a user–defined type. A class can have member functions, member data, member constants, and member types. A class is thee primary mechanism for representing concepts in C++. See also: template class. TC++PL 2.5.2, 10, D&E 2.3.
class hierarchy
a collection of classes organized into a directed acyclic graph (DAG) by derived/base relationships. TC++PL 2.6.2, 12, 15, D&E 1.1, 7.2, 8.2.3.
class template/template class
class parameterized by types, values, or templates. The template arguments necessary to identify the class to be generated for the class template must be provided where a template class is used. For example vector v; generates a vector of ints from the vector template. See also template. TC++PL 13.2, D&E 15.3.
clone
a function that makes a copy of an object; usually a clone function relies on run–time information (e.g. a virtual function call) to correctly copy an object given only a pointer or reference to a sub–object.
closure
object representing a context. C++ does not have general closures, but function objects can be efficiently used to hold specific parts of a context relevant to a computation. TC++PL 22.4.7, 18.4.
code generator
the part of a compiler that takes the output from the front–end and generates code from it. See also: back–end, optimizer.
collection
a term sometimes used as a synonym for container.
Comeau C++
a family of ports of the EDG C++ front–end.
comment
block comment /* … */ or line comment // …
compiler
the part of a C++ implementation that produces object code from a translation unit. See also: front–end, back–end.
complex
standard library complex number template parameterized by scalar type. TC++PL 11.3, 22.5, D&E 3.6.1, 8.5, 15.10.2.1.
compound statement
sequence of statements enclosed in curly braces: { … } See also: try–block. TC++PL 2.3, 6.3.
concept
a C++ language construct, providing type chaecking for template arguments.
concrete type
a type without virtual functions, so that objects of the type can be allocated on the stack and manipulated directly (without a need to use pointers or references to allow the possibility for derived classes). Often, small self–contained classes. See also abstract class, vector, list, string, complex. TC++PL 25.2.
const
attribute of a declaration that makes the entity to which it refers readonly. See also: const member function. TC++PL 5.4, D&E 3.8.
const definition
declaration of a const including an initializer.
const member function
member function declared not to modify the state of the object for which it is called. Can be called for const objects only. TC++PL 10.2.6, D&E 13.3.
constant
literal, object or value declared const, or enumerator.
constant expression
expression of integral type that is evaluated at compile time. TC++PL C.5.
constraint/concept checking
rule that restricts the set of acceptable arguments for a template parameter. For example the argument must have + and
constructor
member function with the same name as its class, used to initialize objects of its class. Often used to establish an invariant for the class. Often used to acquire resources. A constructor establishes a local environment in which member functions execute. See also: order of construction, destructor. TC++PL 10.2.3, D&E 2.11.1.
const_cast
a type conversion operation that conversion between types that differ in const and volatile type modifiers only. See also: cast. TC++PL 15.4.2.1, D&E 14.3.4.
container
(1) object that holds other objects. (2) type of object that holds other objects. (3) template that generates types of objects that hold other objects. (4) standard library template such as vector, list, and map. TC++PL 16.2, 16.2.3, 17, D&E 15.3.
controlled variable
a variable used to express the part of the exit condition of a loop that varies each time around the loop. For example ``i’’ in for (int i=0; i<max></max>
conversion
explicit type conversion or implicit type conversion. See also: user–defined type conversion.
conversion operator
operator function specifying a conversion from a user–defined type to either another user–defined type or a built–in type. Note that constructors cannot define conversions to built–in types. TC++PL 11.4, D&E 3.6.3.
copy assignment
an assignment accepting an object of the class itself as its argument, typically Z::operator=(const Z&). A copy assignment is used for assignment of an object of type T with an object of type T. If a copy assignment is not declared for a class, memberwise copy is used. See also: copy constructor. TC++PL 10.4.4.1, 10.4.6.3 D&E 11.4.
copy constructor
a constructor accepting an object of the class itself as its argument, typically Z::Z(const Z&). A copy constructor is used for initialization of objects of type T with objects of type T. If a copy constructor is not declared for a class, memberwise initialization is used. See also: call–by–value, argument passing, value return, copy assignment. TC++PL 10.4.4.1, 10.4.6.3, D&E 11.4.
copy()
standard algorithm for copying one sequence into another. The two sequences need not be of the same type. TC++PL 18.6.1.
copying class object
an object of a class is copied by the class’ copy assignment and copy constructors. The default meaning of these operations is memberwise copy. TC++PL 10.4.4.1, 10.4.6.3 D&E 11.4.
cout
standard ostream. TC++PL 3.4, 21.2.1, D&E 8.3.1.
cpp
see preprocessor.
crosscast
a cast from a class to a sibling class. See also: dynamic_cast, upcast, downcast. TC++PL 15.4.
Currying
producing a function of N–M arguments by specifying M arguments for a function of N arguments. See also: binder, default argument. TC++PL 18.4.4.1.
data abstraction
programming relying on user–defined types with well–defined interfaces. See also: generic programming and object–oriented programming. TC++PL 2.5, 24.2.2, D&E 9.2.1.
data member
member of a class that can hold a value. A memer can be a static member or a non–static member. TC++PL 2.5.2–3, 10.2, D&E 2.3, 2.5.2.
declaration
an introduction of a name into a scope. The type of the name must be specified. If the declaration also specifies the entity to which the name refers, the declaration is also a definition. TC++PL 4.9, D&E 3.11.5.
decltype
C++ox operator meaning the type of its operand. For example: const double& d1 =2.0; decltype(d1) d2; (d2 will also be a const double&). Primarily useful for writing forwarding functions in generic programming.
default argument
a value specified for an argument in a function declaration, to be used if a call of the function doesn’t specify a value for that argument. This is commonly used to allow a simple interface for common uses while making it easy to use less common facilities by specifying more arguments. See also: default template argument, binder. TC++PL 7.5, 10.2.3, D&E 2.12.2.
default constructor
constructor requiring no arguments. Used for default initialization. TC++PL 10.4.2, 10.4.6, D&E 2.12.2, 15.11.3.
default template argument
a type or value specified for an argument in a template declaration, to be used if a use of the template doesn’t provide a type or value for that argument. This is commonly used to allow a simple interface for common uses while making it easy to use less common facilities by specifying more arguments. See also: default argument. TC++PL 13.4.1, B.3.5.
default value
value defined by a default constructor. For built–in types, the default value is defined to be 0. TC++PL 4.9.5, 10.3.1, 10.4.2 D&E 15.11.3.
definition
a declaration that specifies the entity to which the declared name refers. See also: one definition rule, variable definition, const definition, template definition, function definition. TC++PL 4.9, D&E 15.11.3.
delayed evaluation
technique for eliminating temporary values, and in general to delay a computation until sufficient information is available to do it well. TC++PL 21.4.6.3, 22.4.7.
delete
object destruction operator. Invokes destructor, if any. See also: resource management, memory management, garbage collection, operator delete(). TC++PL 6.2.6, D&E 2.3, 10.2.
deprecated feature
feature left in a programming language for historical reasons only. The standard s committee recommends against its use and warns that it may be removed in future revisions of the standard.
deque
double–ended queue (pronounced deck). A standard library template allowing insertions and deletions at both ends. Use a vector if you need insertions and deletions only at one end (as is typical). Use a list if you need frequent insertions and deletions in the middle. TC++PL 17.2.3.
derived class
a class with one or more base classes TC++PL 2.6.2, 12, 15, D&E 3.5.
design
creating a clean and reasonably simple structure of a system TC++PL 23.3.
destructor
member of a class used to clean up before deleting an object. It’s name is its class’ name prefixed by ‘~’. For example, Foo’s destructor is ~Foo(). Often used to release resources. A destructor is implicitly called whenever an object goes out of scope or is deleted. See also: virtual destructor, order of destruction. TC++PL 10.4.2, D&E 2.11.1, 3.11.2.
digraph
alternative representation for C++ representation characters that doesn’t exist in every national character set, such as {, }, [,], and #: , and %:. TC++PL C.3.1.
double
double–precision floating–point number. TC++PL 4.5.
double dispatch
a technique for selecting a function to be invoked on the dynamic type of two operands. TC++PL 21.2.3.1, D&E 13.8.
downcast
a cast from a base class to one of its derived classes. The name reflects the fact that in programming, trees tend to be drawn growing downwards from the roots. See also: dynamic_cast, upcast, crosscast. TC++PL 15.4.
dynamic type
the type of an object as determined at run–time; e.g. using dynamic_cast or typeid. Also known as most–derived type.
dynamic type safety
type safety enforced at run time (typically requiring a programmer to catch exceptions to deal with violations). An example is range checking for vectors.
dynamic_cast
a type conversion operation that performs safe conversions using on run time type information. Used for navigation of a class hierarchy. See also: downcast, crosscast, static_cast. TC++PL 15.4.1, D&E 14.2.2, 14.3.2.1.
EDG C++ front–end
a quality C++ compiler front–end, which is the core of several well–regarded C++ compilers.
element
an object in a container.
encapsulation
the enforcement of abstraction by mechanisms that prevent access to implementation details of an object or a group of objects except through a well–defined interface. C++ enforces encapsulation of private and proteced members of a class as long as users do not violate the type system using casts. See also: interface and access control. TC++PL 15.3, 24.3.7.4, D&E 2.10.
enum
keyword for declaring enumerations. TC++PL 4.8, D&E 11.7.
enumeration
a user–defined type consisting of a set of named values. TC++PL 4.8, D&E 11.7.
enumerator
a name identifying a value of an enumeration. TC++PL 4.8, D&E 11.7.
escape character/backslash
the character \, also called backslash, sed an initial character in representations of characters that cannot be represented by a single ASCII character, such as newline (‘\n’) and horizontal tab (‘\t’). TC++PL C.3.2.
exception
object thrown by a throw–statement and (potentially) caught by an exception handler associated by a try–block. See also: exception safety, termination semantics, catch. TC++PL 8.3, 14.2, D&E 16.
exception handler
a catch–clause associated with a try–block for handling exceptions of a specified type. TC++PL 8.3.1, 14.3, D&E 16.3–4.
exception handling/error handling
the primary way of reporting an error that cannot be handled locally. An exception is thrown and will be caught by an exception handler or terminate() will be called. See also: exception safety, termination semantics, try–block, throw, catch. TC++PL 8.3, 14, E, D&E 16.
exception safety
the notion that a program is structured so that throwing an exception doesn’t cause unintended side effects. See also: basic guarantee, strong guarantee, and nothrow guarantee. You can download Appendix E Standard–Library Exception Safety of TC++PL describing techniques for exception handling. TC++PL E.2.
executable file
the result of linking the object files of a complete program. See also: compiler, linker.
explicit
keyword used to define a constructor so that it isn’t used for implicit conversions. TC++PL 11.7.1.
explicit call of constructor
See placement new.
explicit call of destructor
destructors are implicitly called when an object goes out of scope or is deleted. However, if a user have taken over construction (using placement new) and destruction, a destructor must be explicitly called. Example. For example, explicit call of destructor is used in the implementation of standard library containers. See also: placement new. TC++PL 10.4.11, E.3.1, D&E 10.5.1.
explicit constructor
constructor so that will not be used for implicit conversions. TC++PL 11.7.1.
explicit instantiation
explicit request to instantiate a template in a specific context. See also: template instantiation. TC++PL C.13.10, D&E 15.10.1.
explicit qualification
(1) by namespace name, see qualified name. (2) by template argument. TCP++L 13.3.2.
explicit type conversion
type conversion (explicitly) requested by the use of a C–style cast, new–style cast, or functional notation. See also, implicit type conversion, user–defined type conversion. TC++PL 6.2.7, D&E 14.3.2.
expression
combination of operators and names producing a value. TC++PL 6.2.
extended type information
any scheme that provides additional information base on the standard run time type information. TC++PL 15.4.4.1, D&E 14.2.5.2.
extension
see language extension
extern
a keyword used to indicate that the definition of an entity being declared is defined elsewhere. Because extern: is only necessary for global variables it is largely redundant.
extracter
an iostream >> (put to) function. TC++PL 21.2,21.3, D&E 8.3.1.
facet
a class representing a primitive aspect of a locale, such as a way of writing an integer or a character encoding. TC++PL D.3.
FALSE
bool value; converts to 0. TC++PL 4.2, D&E 11.7.2.
fat interface
an interface with more member functions and friends than are logically necessary. TC++PL 24.4.3.
field
see bitfield.
file
a sequence of bytes or words holding information in a computer. The term file is usually reserved to information placed on disk or elsewhere outside the main memory. The iostream part of the C++ standard library provides ifstream, ofstream, and fstream as abstraction for accessing files. TC++PL 21.5.
file stream
stream attached to a file. See also, fstream, ifstream, ofstream. TC++PL 21.5.1.
finally
a language construct supporting ad hoc cleanup in some languages. Similar, but not identical to C++’s catch(…). Use the resource acquisition is initialization technique instead.
find()
standard library linear search algorithm for a value in a sequence. TC++PL 18.5.2.
find_if()
standard library linear search algorithm for an element meeting a search criterion in a sequence. TC++PL 18.5.2.
float
single–precision floating–point number. TC++PL 4.5.
floating–point literal
the source text representation of a floating point value. For example, 0.314e1. TC++PL 4.5.1.
floating–point type
a float, double, or long double. A floating–point number is typically represented as a mantissa and an exponent. TC++PL 4.5.
for–statement
iteration statement specifying an initializer, an iteration condition, a next–iteration operation, and a controlled statement. TC++PL 6.3.3.
free store/dynamic memory
memory allocated by new; also called dynamic memory. Often standard library facilities, such as vector, can be used to avoid explicit use of free store. TC++PL 6.2.6, 10.4.3, D&E 2.11.2, 11.4.2.
free()
C standard deallocation function. Use delete instead.
free–standing function
a function that is not a member function. Useful for decreasing coupling between representation and algorithm. TC++PL 7, 18.
friend
a function or class explicitly granted access to members of a class by that class. TC++PL 11.5, C.11.4, D&E 2.10, 3.6.1–2.
friend function
a function declared as friend in a class so that it has the same access as the class’ members without having to be within the scope of the class. And, no, friends do not violate encapsulation. TC++PL 11.5, 11.2.3, C.11.4, D&E 2.10, 3.6.1.
front–end
the parts of a compiler that perform lexical and syntax checking, type checking, and initial semantic checking of a translation unit. Typically all compiler error messages comes from the front–end. See also: back–end. D&E 3.3.
front_inserter()
returns an iterator that can be used to add elements at the front of the container . TC++PL 19.2.4.
fstream
a file stream for input and output.
function
a named sequence of statements that can be invoked/called given arguments and that might return a value. The type of the function includes the number and types of argument and the type of the value returned, if any. See also: function declaration, function body. TC++PL 2.3, 7, D&E 2.6.
function argument
an argument to a function.
function body
the outermost block of a function. See also: try–block, function definition. TC++PL 2.7, 13.
function declaration
declaration of a function, including its name, argument types, and return type.
function definition
function declaration including a function body.
function parameter
a parameter of a function.
function prototype
C term for a function declaration that isn’t also a function definition. D&E 2.6.
function template
function parameterized by types, values, or templates. The function to be generated from a template function can usually be deduced from the function arguments in a call. For example, sort(b,e) generates sort(b,e) from the sort() template function if b and e are standard library vector iterators. If a template argument cannot be deduced, it must be provided through explicit qualification. See also template. TC++PL 13,3, D&E 15.6.
function try–block
try–block associated with the outmost block of a function, the function body. TC++PL 3.7.2.
functor/function object
object with the application operator, operator()(), defined so that it can be called like a function. A function object is more general than a function because it can hold data and provide additional operations. Sometimes called a functor. Given current compiler technology, simple function objects inline better than pointers to functions, so that parameterization with function objects can be far more efficient than use of pointers to functions or virtual functions. See also: binder, adapter, inlining. Example. TC++PL 18.4.
G++
see GNU C++.
garbage collection/automatic garbage collection
techniques for reclaiming unused memory without relying on user–supplied delete or free() commands. A permitted but not required technique for C++. Commercial and free garbage collectors exist for C++: See my C++ page. Use of classes that control their own storage, such as the standard library vector, string, and map, reduces the need for garbage collection. See also: resource acquisition is initialization, destructor. TC++PL C.9.1. D&E 10.7.
general–purpose programming language
(1) a programming language intended for use in a wide range of application areas without restrictions that make it totally unsuitable for traditional major uses of computers, such as mathematical computations, data processing, text processing, graphics, and communications. (2) a language that can do what at least as much as other languages called general purpose can do. See also: C++.
generic programming
programming using templates to express algorithms and data structures parameterized by data types, operations, and polices. See also: polymorphism, multi–paradigm programming. TC++PL 2.7, 24.4.1, D&E 15.11.2.
get function
see >>.
global data
data defined in the global scope. This is usually best avoided because a programmer can’t easily know what code manipulates it and how. It is therefore a common source of errors. Global constants are usually ok.
global scope
the scope containing all names defined outside any function, class, or namespace. Names in the global scope can be prefixed by ::. For example, ::main(). TC++PL 2.9.4.
glossary
collection of glosses; lists and explanations of special words.
goto
the infamous goto. Primarily useful in machine generated C++ code. TC++PL 6.3.4.
grammar
a systematic description of the syntax of a language. The C++ grammar is large and rather messy. Some of the syntactic complexity was inherited from C. TC++PL A, D&E 2.8.
handle
an object that controls access to another. Often, a handle also controls the acquisition and release of resources. A common use is for a handle to control access to a variably–sized data structure. See also: resource acquisition is initialization, vector, string, smart pointer. TC++PL 25.7, D&E 11.5.2.
handle class
a small class that provides interface to an object of another class. A handle is the standard way of providing variable sized data structures in C++. Examples are string and vector. TC++PL 25.7.
handler
see exception handler
hash_map
hashed contained based on the standard library framework. Not (yet) part of the standard but very common in libraries based on the standard library. See also: map, vector, list. TC++PL 17.6.
header file/.h
file holding declarations used in more than one translation unit. Thus, a header file acts as an interface between separately compiled parts of a program. A header file often contains inline function definitions, const definitions, enumerations, and template definitions, but it cannot be #included from for than one source file if it contain non–inline function definitions or variable definitions. TC++PL 2.4.1, 9.2.1. D&E 2.5, 11.3.3.
higher–order function
functions that produce other functions. C++ does not have general higher–order functions, but by returning function objects a function can efficiently emulate some techniques traditionally relying of higher–order functions. See also: binder. TC++PL 18.4.4.