C

A C function is one that is inherited from the C library. Because C does not have a number of features that have been added in C++, such as function overloading and reference arguments, C functions must often be called in different ways from those we use when calling a C++ function.

The C standard library is a part of the C++ standard library. It consists of a collection of functions that were originally written for users of the C programming language. Because C++ is a descendant of C, these functions are often still useful in C++ programs.

The C++ standard library is a collection of code defined by the ISO (International Standards Organization), that must be included with every standards-compliant compiler. Unfortunately, as of this writing, there are no completely standards-compliant compilers, but the one on the CD in the back of the book should be close enough for programs you will be writing. The types defined in the standard library include the vector and string classes that we have used either directly or indirectly throughout this book, as well as hundreds of other very useful types and functions.

A C string is a sequence of characters referred to by a char* pointer. Do not confuse this with the C++ string class.

A C string literal is a literal value representing a variable number of characters. An example is “This is a test.”. C string literals are surrounded by double quotes (“). The name of this data type indicates its origin in C, which did not have a real string type such as the C++ string. While these two types have some similarities, they behave quite differently and should not be confused with one another.

A cache is a small amount of fast memory where frequently used data is stored temporarily.

Call; see function call or call instruction.

A call instruction is an assembly language instruction used to implement a function call. It saves the program counter on the stack and then transfers execution from the calling function to the called function.

A called function is a function that starts execution as the result of a function call. Normally, it returns to the calling function via a return statement when finished.

A calling function is a function that suspends execution as a result of a function call; the called function begins execution at the point of the function call.

The carriage return character is used to signal the end of a line of text. Also see newline in the index.

A function is said to be case-sensitive if upper- and lower-case letters are considered to be distinct.

A function is said to be case-insensitive if upper- and lower-case letters are considered equivalent. See less_nocase in the index.

To catch an exception means to handle an interruption in the normal flow control of a program, usually due to an error condition. An exception is generated via a throw statement, and can be caught in a function that has directly or indirectly called the function that threw the exception. The catch keyword is used in conjunction with try, which specifies a block of code to which a specific catch statement or statements may be applicable. A catch can specify the type of exceptions that it will handle, or can use “...” to specify that it will handle any and all exceptions.

A char is an integer variable type that can represent either one character of text or a small whole number. Both signed and unsigned chars are available for use as “really short” integer variables; a signed char can represent a number from -128 to +127, whereas an unsigned char can represent a number from 0 to 255. (In case you were wondering, the most common pronunciation of char has an “a” as in “married”, while the “ch” sounds like “k”. Other pronunciations include the standard English pronunciation of “char” as in overcooking meat, and even “car” as in “automobile”.)[2]

[2] Actually, a char can be larger than 8 bits. However, it is required by the C++ standard to be at least 8 bits, and the most common compilers and machines indeed do have 8-bit chars.

A char* (pronounced “char star”) is a pointer to (i.e., the memory address of) a char or the first of a group of chars.

Child class: see inheritance.

cin (pronounced “see in”) is a predefined istream; it gets its characters from the keyboard.

A class is a user-defined type; for example, std::string is a class.

A class designer is a programmer who designs classes. Also see application programmer.

A class implementation tells the compiler how to implement the facilities defined in the class interface. It is usually found in an implementation file, which the compiler on the CD in the back of this book assumes has the extension .cpp.

A class interface tells the user of the class what facilities the class provides by specifying the class's public member functions. The class interface also tells the compiler what data elements are included in objects of the class, but this is not logically part of the interface. A class interface is usually found in a header file — that is, one with the extension .h.

The class membership operator, ::, indicates which class a function belongs to. For example, the full name of the default constructor for the string class is string::string().

class scope describes the visibility of member variables — that is, those defined within a class. A variable with this scope can be accessed by any member function of its class; its accessibility to other functions is controlled by the access specifier in effect when it was defined in the class interface.

A comment is a note to yourself or another programmer; it is ignored by the compiler. The symbol // marks the beginning of a comment; the comment continues until the end of the line containing the //. For those of you with BASIC experience, this is just like REM (the “remark” keyword) — anything after it on a line is ignored by the compiler.

Compilation is the process of translating source code into an object program, which is composed of machine instructions along with the data needed by those instructions. Virtually all software is created by this process.

A compiler is a program that performs compilation.

A compiler-generated function is supplied by the compiler because the existence of that function is fundamental to the notion of a concrete data type. The compiler will automatically generate its own version of any of the following functions if they are not provided by the creator of the class: the assignment operator, the copy constructor, the default constructor, and the destructor.

A compiler warning is a message from the compiler informing the programmer of a potentially erroneous construct. While a warning does not prevent the compiler from generating an executable program, a wise programmer will heed such warnings, as they often reveal hazardous coding practices.

Compile time means “while the compiler is compiling the source code of a program”.

Concatenation is the operation of appending a string to the end of another string. Also see operator + in the index.

A concrete data type is a class whose objects behave like variables of native data types. That is, the class gives the compiler enough information that objects of that class can be created, copied, assigned, and automatically destroyed at the end of their useful lifetimes, just as native variables are.

A console mode program is a program that looks like a DOS program rather than a Windows program.

The keyword const has two distinct meanings as employed in this book. The first is as a modifier to an argument of a function. In this context, it means that we are promising not to modify the value of that argument in the function. An example of this use might be the function declaration string& operator = (const string& Str);. The second use of const in this book is to define a data item similar to a variable, except that its value cannot be changed once it has been initialized. For this reason, it is mandatory to supply an initial value when creating a const. An example of this use is const short x = 5;.

A constructor is a member function that creates new objects of a (particular) class type. All constructors have the same name as that of the class for which they are constructors; for example, the constructors for the string class have the name string. A constructor that takes only one required argument is also a conversion function.

A continuation expression is the part of a for statement computed before every execution of the controlled block. The block controlled by the for will be executed if the result of the computation is true but not if it is false. See for statement for an example.

The continue keyword causes execution of a for loop to continue to the next iteration without executing any further statements in the current iteration.

A controlled block is a block under the control of a loop control statement or an if or else statement. The controlled block of a loop control statement can be executed a variable number of times, whereas the controlled block of an if or else statement is executed either once or not at all.

Controlled statement; see controlled block.

A conversion function is a member function that converts an object of its class to some other type, or vice versa. Also see implicit conversion.

A copy constructor makes a new object with the same contents as an existing object of the same type.

cout (pronounced “see out”) is a predefined ostream; characters sent to it are displayed on the screen.

CPU is an abbreviation for Central Processing Unit. This is the “active” part of your computer, which executes all the machine instructions that make the computer do useful work.

The curly braces { and } are used to surround a block. The compiler treats the statements in the block as one statement.

A cursor is an abstract object that represents the position on the screen where input or output will occur next.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset