KeytermDefined Terms


Defined Terms

assert

Preprocessor macro that takes a single expression, which it uses as a condition. If the preprocessor variable NDEBUG is not defined, then assert evaluates the condition. If the condition is false, assert writes a message and terminates the program.



block

A sequence of statements enclosed in curly braces. A block is a statement, so it can appear anywhere a statement is expected.



break statement

Terminates the nearest enclosing loop or switch statement. Execution transfers to the first statement following the terminated loop or switch.



case label

Integral constant value that follows the keyword case in a switch statement. No two case labels in the same switch statement may have the same value. If the value in the switch condition is equal to that in one of the case labels, control transfers to the first statement following the matched label. Execution continues from that point until a break is encountered or it flows off the end of the switch statement.



catch clause

The catch keyword, an exception specifier in parentheses, and a block of statements. The code inside a catch clause does whatever is necessary to handle an exception of the type defined in its exception specifier.



compound statement

Synonym for block.



continue statement

Terminates the current iteration of the nearest enclosing loop. Execution transfers to the loop condition in a while or do or to the expression in the for header.



dangling else

Colloquial term used to refer to the problem of how to process nested if statements in which there are more ifs than elses. In C++, an else is always paired with the closest preceding unmatched if. Note that curly braces can be used to effectively hide an inner if so that the programmer can control with which if a given else should be matched.



declaration statement

A statement that defines or declares a variable. Declarations were covered in Chapter 2.



default label

The switch case label that matches any otherwise unmatched value computed in the switch condition.



exception classes

Set of classes defined by the standard library to be used to represent errors. Table 6.1 (p. 220) lists the general purpose exceptions.



exception handler

Code that deals with an exception raised in another part of the program. Synonym for catch clause.



exception specifier

The declaration of an object or a type that indicates the kind of exceptions a catch clause can handle.



expression statement

An expression followed by a semicolon. An expression statement causes the expression to be evaluated.



flow of control

Execution path through a program.



goto statement

Statement that causes an unconditional transfer of control to a specified labeled statement elsewhere in the program. gotos obfuscate the flow of control within a program and should be avoided.



if else statement

Conditional execution of code following the if or the else, depending on the truth value of the condition.



if statement

Conditional execution based on the value of the specified condition. If the condition is true, then the if body is executed. If not, control flows to the statement following the if.



labeled statement

A statement preceded by a label. A label is an identifier followed by a colon.



null statement

An empty statement. Indicated by a single semicolon.



preprocessor macro

Function like facility defined by the preprocessor. assert is a macro. Modern C++ programs make very little use of the preprocessor macros.



raise

Often used as a synonym for throw. C++ programmers speak of "throwing" or "raising" an exception interchangably.



switch statement

A conditional execution statement that starts by evaluating the expression that follows the switch keyword. Control passes to the labeled statement with a case label that matches the value of the expression. If there is no matching label, execution either branches to the default label, if there is one, or falls out of the switch if there is no default label.



terminate

Library function that is called if an exception is not caught. Usually aborts the program.



throw expression

Expression that interrupts the current execution path. Each throw tHRows an object and transfers control to the nearest enclosing catch clause that can handle the type of exception that is thrown.



try block

A block enclosed by the keyword try and one or more catch clauses. If the code inside the try block raises an exception and one of the catch clauses matches the type of the exception, then the exception is handled by that catch. Otherwise, the exception is handled by an enclosing try block or the program terminates.



while loop

Control statement that executes its target statement as long as a specified condition is true. The statement is executed zero or more times, depending on the truth value of the condition.





C++ Primer
C Primer Plus (5th Edition)
ISBN: 0672326965
EAN: 2147483647
Year: 2006
Pages: 223
Authors: Stephen Prata

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net