C/C++ Glossary

Friday, November 24, 2006

Definitions take directly from MSDN Online Voices "Deep C++" column, C++ Templates: The Complete Guide, and the C++ Standard: ISO/IEC 14882:2003.


ANSI


The American National Standards Institute technical committee, once designated X3J11 but now known simply as J11, is responsible for creating and maintaining the U.S. C programming language standard. A similar committee, J16, is responsible for the collateral U.S. C++ standard. Both committees represent the U.S. on the corresponding ISO committees.


ANSI C


The C language specified in ANSI's 1989 C standard, and largely inherited from K&R C. Also known as C89 (from its year of adoption).


ANSI C standard


Formal document name: ANSI X3.159-1989. The U.S. C language standard published by ANSI in 1989, technically equivalent to—and supplanted by—the ISO C standard published a year later.


The ARM


Acronym for The Annotated C++ Reference Manual, written by Margaret Ellis and Bjarne Stroustrup, and first published in 1991. The ARM is to standard C++ as K&R is to standard C: The de facto standard of its day, and the foundation for the eventual ISO standard.


argument deduction


Instead of always requiring explicit <...> function template arguments, compilers may deduce those template arguments from a function call's context. The compiler attempts to match the call's argument type(s) against the parameter patterns in candidate function templates (and their possible explicit specializations). If a single unambiguously best match exists, the function is implicitly instantiated.


Argument deduction allows calls to template functions to look like calls to non-template functions. However, the deduction algorithm is not trivial, and the compiler cannot always deduce a best match. Conversely, the compiler may deduce a match that is not what you expect, since the template argument-to-parameter conversion rules differ from other C++ conversion rules.


automatic storage duration, automatic object


A C or C++ local-scope object explicitly declared auto or register, or not explicitly declared extern or static, has automatic storage duration. An object with such storage duration is an automatic object. Storage for these objects lasts until the block in which they are created exits. Automatic objects are what most programmers think of as "local variables" or "stack variables."


CV qualifiers


Standard-ese for the const and volatile type qualifiers.


D&E


Acronym for The Design and Evolution of C++, written by Bjarne Stroustrup, and first published in 1994. While the C and C9x standards have corresponding Rationale documents, the C++ standard does not. Instead the D&E serves as the de facto Rationale for standard C++.


declarator


Simplistic definition: The "right side" of a C or C++ declaration.


Robust definition: Within a C or C++ declaration, the name of a single object, function, or typedef, plus possible associated modifiers:


  • *s and &s

  • cv-qualifiers (const and volatile)

  • name specifiers (like std::)

  • function parameters within ()

  • array lengths within []

  • exception specification

  • initializer


Examples:


&a[N]


* const p = 0


X::f(int) throw()


Declarators are a Big Deal—the entire clause 8 of the C++ standard is devoted to them.


Along with declaration specifiers (the "left side" of declarations), declarators comprise the most convoluted and error-prone syntax in the C and C++ grammars. When confronted by obscure compile-time declarator errors, even seasoned programmers will randomly throw in extra syntax—typically *s and ()s—hoping that the errors will magically go away.


dynamic storage duration, dynamically created/destroyed object


A C++ object is dynamically created via a new expression, and dynamically destroyed via a delete expression. Such objects have dynamic storage duration; their storage lasts until freed by operator delete or operator delete[].


dynamic type


The type of the most derived object to which the lvalue denoted by an lvalue expression refers.


Example:


If a pointer p whose static type is “pointer to class B” is pointing to an object of class D, derive from B, the dynamic type of the expression *p is “D.” References are treated similarly.


class B { };

class D : public B { };


D d;

B* p = &d; // dynamic type of *p is D


The dynamic type of an rvalue expression is its static type.


EH


Shorthand notation for standard C++ exception handling.


fully constructed


A C++ object is fully constructed if, and only if, its constructor has completed and its destructor has not begun. Full construction is aborted if the constructor throws an exception.


Since contained subobjects construct before the containing constructor begins, the property of full construction is recursive: If one subobject deep in a class hierarchy throws an exception, all nested containing objects up the chain fail to construct unless/until the exception is handled. Caveat Constructor.


ISO


Also known as the International Organization for Standardization. Contrary to popular belief, the name ISO is not an acronym, but derives from the Greek "isos" meaning "equal." (The English prefix "iso-" also derives from this same word.)


ISO committees JTC1/SC22/WG14 and WG21 are responsible for creating international C and C++ language standards, respectively. The committees comprise representatives from national standards bodies; in the United States, those national bodies are ANSI committees J11 and J16.


ISO C standard, a.k.a C standard


Formal document name: ISO/IEC 9899:1990. There is also a corresponding Rationale.


This document is the international C language standard published by ISO in 1990. It is technically identical to the ANSI C standard; however, the two published standards use slightly different nomenclature and section numbering.


Since 1990, ISO has updated the C standard with three addenda:


ISO/IEC 9899 AM1. 1995 Amendment 1, adding international character support. Also known as Normative Addendum 1.


ISO/IEC 9899 TCOR1. 1995 Technical Corrigendum 1, correcting technical errors in the standard.


ISO/IEC 9899 TCOR2. 1996 Technical Corrigendum 2, correcting a smaller number of additional technical errors.


The C standard is not free, nor can you purchase it from ISO. You must instead purchase it from either your nation's ISO member body or a reseller.


ISO C9x standard (Final Committee Draft)


Formal document name: WG14/N843. There is also a corresponding Rationale.


ISO working group JTC1/SC22/WG14 is currently revising the entire C standard. The C language specified by this revised standard is colloquially called C9x. As the name suggests, C9x standardization is scheduled for completion in the 1990's.


ISO C++ standard, a.k.a. C++ standard


Formal document name: ISO/IEC 14882:1998. This document is the international C++ language standard published by ISO in 1998.


K&R


Shorthand for Brian Kernighan and Dennis Ritchie's book The C Programming Language, first edition. Published in 1978, K&R formed the basis of the ANSI C standard introduced a decade later.


K&R C


The C language specified in K&R. K&R C lacks several key features of standard C: function prototypes, const and volatile keywords, void type, enumeration types, and a well-defined library.


lvalue


Literally an "l value" or "left value." So-called because, in K&R C, an lvalue can appear on the left side of an assignment expression. In standard C or C++, an lvalue is more properly a "locator value" designating an object.


Lvalues are either modifiable or non-modifiable, a concept generally mapping to non-const and const objects, respectively. Their names aside, non-modifiable (const) lvalues cannot appear on the left in an assignment. (Because K&R C does not have the const keyword, all K&R lvalues are modifiable.)


name decoration or name mangling


Encoding of C++ names into C pseudo-names discernible by C linkers. In particular, such mangling allows C linkers to support class/namespace scope and function overloading, by turning what would be invalid redefinition of the same name into a new definition of a unique synthetic name.


The C++ standard does not regulate the algorithm mapping between original C++ names and linker-friendly mangled names. Instead, each translator vendor is free to create a unique naming scheme. This suggests that object files with different name-mangling schemes cannot be mixed.


(Note that other considerations—parameter-passing method, register allocation, stack alignment—also prevent inter-vendor object file mixing. Name mangling just takes a bad interoperability situation and makes it worse.)


overloaded declarations


When two or more different declarations are specified for a single name in the same scope, that name is said to be overloaded. Two declarations in the same scope that declare the same name but with different types.


overload resolution


When an overloaded function name is used in a call, which overloaded function declaration is being referenced is determined by comparing the types of the arguments at the point of use with the types of the parameters in the overloaded declarations that are visible at the point of use. This function selection process is called overload resolution.


partially constructed


A C++ object is partially constructed if, and only if, its constructor has not finished execution.


RTTI


Literally "Run-Time Type Identification," the standard C++ mechanism for class objects to identify their dynamic or run-time types. RTTI is supported by the keywords dynamic_cast and typeid and the standard library header . An object's run-time identity is typically stored as data accessed through the object's v-table.


rvalue


Literally an "r value" or "right value." Rvalues always appear on the right side of an assignment statement. Unlike lvalues, which designate objects, rvalues designate values only—at least in C. C++ also has "class rvalues" designating unnamed temporary objects of a constructed (class) type; such objects are conceptually values of that type.


Standard C


The C language specified in the ISO C standard. Technically identical to ANSI C.


Standard C++


The C++ language specified in the ISO C++ standard.


Standard template library (STL)


A collection of C++ class and function templates, originally created by Stepanov, et al. at Hewlett-Packard, and later modified for and incorporated into the C++ standard library.


The STL is really two distinct things:


  • a set of rigorously-defined design patterns

  • representations of those patterns


The design patterns include:


  • object containers

  • algorithms manipulating container elements

  • iterators accessing container elements

  • allocators managing container memory

  • adapters giving containers and algorithms new interfaces


The C++ standard library implements many templates that hew to the STL design patterns. Indeed, many programmers are content to use just the library's implementation. However, if you follow the design-pattern rules, you can create containers, algorithms, and so on, that interact in complex yet predictable ways with the standard library.


static type


The type of an expression, which type results from analysis of the program without considering execution semantics. The static type of an expression depends only on the form of the program in which the expression appears, and does not change while the program is executing.


storage-class specifier


In standard C, any of the keywords


  • auto

  • extern

  • register

  • static


In standard C++, the above keywords plus


  • mutable


As the term suggests, a storage class specifier generally describes what kind of storage objects occupy, how long that storage exists, and how visible the storage is. The anomaly is mutable, which really doesn't describe storage at all. However, since mutable can appear in exactly the same grammatical contexts as the other "real" storage class specifiers, considering mutable a storage class specifier does simplify the C++ grammar.


subobject


A C++ object contained by other objects. A subobject is a named data member object, an unnamed base class object, or an array element.


Ant. complete object.


template


A construct that represents a family of classes or functions. It specifies a pattern from which actual classes or functions can be generated by substituting the template parameters by specific entities.


template argument


The "value" substituted for a template parameter. This "value" is usually a type, although certain constant values and templates can be valid template arguments too.


template argument deduction


The process that implicitly determines the template arguments from the context in which template arguments are used.


template-id


The combination of a template name followed by template arguments in angle brackets.


template parameter


A generic placeholder in a template. The most common kind of template parameter are type parameters, which represent types. Non-type parameters represent constant values of a certain type, and a template template parameters represent class templates.


type qualifiers


To the CV qualifiers const and volatile, C9X adds a third: restrict. Rather than call the resulting set of attributes "CRV qualifiers" or some such, the C9X standard committee elects to call them simply type qualifiers.



Posted by janvier at 10:53 AM 0 comments