C + + keyword is a reserved word summary

Source: Internet
Author: User
Tags control characters exception handling goto reserved volatile

1.asm (assembly), as follows:

ASM (instruction String);

Allows you to embed assembly code in C + + programs.
2. Auto (automatic, automatic) is a storage type identifier that indicates that the variable "automatic" has a local scope, and a block-scoped variable declaration (such as a variable declaration in the For Loop body) defaults to the auto storage type.
3. BOOL (Boolean) type, the basic data structure in C + +, whose value can be either true (true) or False (false). The bool type in C + + can be mixed with int, specifically 0 for false, and not 0 for true. BOOL types are often used for conditional judgments and function return values.
4. Break (interrupt, jump out), used in switch statements or circular statements. After the program encounters a break, it skips the program segment and continues with the subsequent statement execution.
5. The case is used in the switch statement to determine the different condition types.
6. Catch catch and try statements are used together for exception handling.
7. Char Char (character, character) type, the basic data structure in C + +, whose value is generally 0~255 int. These 256 characters correspond to 256 ASCII codes. The data for the char type requires a single

Enclosed in quotes. 8.class Class (Class) is the foundation of C + + object-oriented design. Declare a class using the class keyword.
9. The object or variable modified by the const const (constant, constant) cannot be changed, and the function cannot change the variable declared outside the function or call any non-const function. Add a const to the declaration and definition of a function after the last parenthesis in the function argument list. In C + +, declaring a variable with const means that the variable is a constant with a type that can be substituted for #define and has more than one type of information, and that it executes a #define link that can be placed in a header file, but in C, its declaration must be placed in the source file (that is,. c file), in C, Const declares a variable, except that it cannot change its value, it is still a variable. such as const double PI (3.14159), or const double pi = 3.14159;
Const_cast usage:const_cast<type_id> (expression)

This operator is used to modify the const or volatile property of a type. In addition to the const or volatile modification, the type_id and expression are of the same type. The constant pointer is converted to a very measured pointer and still points to the original object;

A constant reference is converted to a very literal reference and still points to the original object, and the constant object is converted to a very measured object.
Continue.

Continue (Continue) keyword is used for looping structures. It skips the part of the code snippet, and unlike break, continue does not go into the part of the code snippet, but rather restarts the new loop. So it is the meaning of "continue circulation", not break (jump out).
A. Default

Default is used for switch statements. When the switch is not satisfied with all of the case, it will go into default execution. Default can only be placed after all the case of the switch statement and is optional.
Delete

Delete (delete) frees the memory space that the program dynamically requests. Delete is usually a pointer or array [], and can only delete a pointer that was requested through the new keyword, otherwise a segment error occurs.
Do

Do-while is a kind of cyclic structure. Unlike the while loop, the Do-while loop guarantees at least one entry into the loop body.
Double

Double (double-precision) type, the basic data structure in C + +, in which a floating-point number is stored in a double precision form.
dynamic_cast

dynamic_cast (Dynamic conversion) allows type conversions at run time, enabling programs to safely convert types in a class hierarchy. Dynamic_cast provides two ways to convert a base class pointer to a derived class pointer, or to convert the left value of a base class to a reference to a derived class.
. else else is immediately followed by the IF, for the selection of an If.
Enum

Enum (enum) type, giving a series of fixed values that can only be selected in this area.
Explicit

The explicit (explicit) effect is that the "prohibit single parameter constructor" is used for automatic type conversions, where the typical example is the container type. In this type of constructor you can pass the initial length as a parameter to the constructor.
Export

To access a variable or object in another compilation unit, such as another code file, for common types, including basic data classes, structs, and classes, you can use keyword extern to work with these variables or objects, but for template types, you must use standard C + + when defining these template class objects and template functions The newly added keyword export (export).
extern

an extern (external) Declaration variable or function is an external link, that is, the variable or function name is visible in other files. The variable (external variable) that is modified by it is statically allocated, that is, when the program starts, and then it is released at the end. A variable or function declared with it should be defined (implemented) in another file or elsewhere in the same file. Declare a variable or function in a file by default

To be used externally. In C + +, you can also use to specify a link in another language, which needs to be used in conjunction with a specific conversion character. Only "C" conversion flags are currently supported to support C compiler links. There are two forms of using this situation:

extern "C" declaration statement

extern "C" {declaration statement block}
False

False (False), the basic data structure of C + + is one of the values of type bool. Equal to the 0 value of Int.
Float

Float (floating-point number), basic data structure in C + +, with precision less than double.
For

For is one of the looping constructs in C + +, used to have a definite start and end.

Fc1

Target ping  fan ú Carpenter silky difficult  Square Ridge?
Friend.

Friend (friend) declares a friend relationship. A friend can access a private/protected member in a class that has a friend relationship, and the primary purpose of accessing the private/protected members of a class directly through friends is to improve efficiency. Friends include friend functions and friend classes.
Goto

Goto (GO), for unconditional jump to a label at the beginning of execution.
An. If

if (if), one of the conditional statements in C + +, you can choose to enter a branch execution based on the value of the following bool type.
Inline

The definition of the inline (inline) function is expanded at the call at compile time. Inline functions generally consist of short statements, which can improve program efficiency.
int

int (integer, Integer), the basic data structure in C + +, used to represent integers, with a precision less than long.
Long

A long integer, an integer, and a basic data structure in C + +, used to represent long integers.
mutable

mutable (variable) is a less commonly used keyword in C + +. Can be used only for non-static and very data members of a class. Because the state of an object is determined by the Non-static data member of the object, the state of the image will change as the data member changes. If a member function of a class is declared as a const type, it means that the function does not change the state of the object, that is, the function does not modify the Non-static data members of the class. However, there are times when you need to assign values to the class's data members in the class function, which requires the mutable keyword.
Namespace

Namespace (namespaces) are used to logically organize classes, which is a larger structure than class.
New

New (newly created) is used to create a new object. The new operator always returns a pointer. Created by new
operator

The operator (operator) is used for operator overloading. This is a special function in C + +.
Private

Private, access control characters in C + +. Fields that are marked private are accessible only in this class and in friends.
protected.

protected (protected), access control characters in C + +. Fields that are marked as protected can only be accessed in this class and in their inherited classes and friends.
Panax Notoginseng. Public

Public (common), access control characters in C + +. Fields that are marked public can be in any class
38.register

Registers (registers) declared variables are called register variables that, if possible, are stored directly in the machine's registers, but do not work with the 32-bit compiler, and when global optimizations is open, it makes a choice whether it is placed in its own register. , but other symbols related to the Register keyword are valid for the 32-bit compiler.
Reinterpret_cast

Usage:reinpreter_cast<type-id> (expression) Type-id must be a pointer, reference, arithmetic type, function pointer, or member pointer. It can convert a pointer to an integer, or you can convert an integer to a pointer (first converts a pointer to an integer, converts the integer to a pointer of the original type, and you get the original pointer value).
Return

Return (returns) is used to return a value in a function. The program is returned immediately after execution to the return statement, and the statement following returns cannot be executed to.
-Short

Short (shorter integer), basic data structure in C + +, used to represent integers, with precision less than int.
Signed.

Signed (signed) indicating that the type is a signed number, as opposed to unsigned. numeric types (integer and floating-point type) can be decorated with signed. But the default is signed, so it is generally not used explicitly.
sizeof

Because the size of each type of C + + is determined by the compiler itself, in order to increase portability, you can use the sizeof operator to obtain the number of bytes that the data type occupies.
Static

static (static) variables are scoped to a file, the program allocates space at the beginning, and the space is released at the end, the default is initialized to 0, and the value can be changed when used. A static variable or static function that only the code in this file can access, and its name (variable name or function name) is not visible in other files. It is also referred to as a "file scope." A member variable in a C + + class is declared static (called a static member variable), meaning that it is shared by all instances of the class, meaning that when an instance of a class modifies the static member variable, its modified value is seen in all other instances of the class , and static member functions of a class can access only static members (variables or functions). A static member variable of a class must be initialized in the scope of the file in which it is declared to be used, and the private type is no exception.
Static_cast

Usage: static_cast < Type-id > (expression) This operator converts expression to Type-id type, but does not have run-time type checking to guarantee the security of the conversion. It mainly has the following several uses:

① is used for a pointer or reference conversion between a base class and a subclass in a class hierarchy. It is safe to perform an upstream conversion (a pointer or reference to a base class representation) for a downward conversion (which converts a base class pointer or reference to a subclass representation) and is unsafe because there is no dynamic type checking.

② is used for conversions between basic data types, such as converting an int to char and converting an int to an enum. The security of this transformation also needs to be ensured by developers.

③ converts an empty pointer to a null pointer to the target type.

④ Convert any type of expression into a void class?

Note: static_cast cannot convert the const, Volitale, or __unaligned attributes of expression.
struct.

struct (structure) type, similar to class keyword, and C language compatibility (class keyword is not compatible with C language), you can implement object-oriented programming
Switch

A switch (transformation) is similar to a if-else-if statement and is a multiple-branched statement. It provides a concise writing and can generate more efficient code. However, the decision behind the switch can only be int (char is OK, but Char is essentially an int type). The final default branch of the switch statement is optional. Its usage is:
Template.

Template (template), the implementation of the generic mechanism in C + +.
This

This returns a pointer to the caller itself.
Throw

Throw (thrown) to implement the exception handling mechanism of C + +, you can "throw" an exception through the Throw keyword.
A. True

True (True), the basic data structure of C + + is one of the values of type bool. A non-0 value equal to int.
Try

Try (try) to implement the exception handling mechanism for C + +. You can call a function that might throw an exception in a try, and then catch and handle it in a catch after a try.
typedef

typedef (type define), whose format is: typedef type definition name;

A type description defines a new name for a data type rather than a new data type. The definition name represents the new name for this type.
typeID

Indicates the actual derived type of the object that the pointer or reference points to.
TypeName

The TypeName (type name) keyword tells the compiler to interpret a particular name as a type. You must use the TypeName keyword for a name in the following situations:

1. A unique name (which can be interpreted as a type) that is nested within another type.

2. Depending on a template parameter, this means that the template parameter contains the name in some way. When a template parameter causes the compiler to identify a type, a misunderstanding occurs.
Union

Union (Union), similar to an enum. The difference is that the enum is essentially an int type, and the union can be used for all types, and that the space occupied varies with the actual type size.
Unsigned

unsigned (unsigned) indicating that the type is unsigned, as opposed to signed.
A. Using

Indicates the use of namespace.
Virtual

Virtual (virtual), C + + to implement the polymorphic mechanism.
. void

void (empty), which can be returned as a function, indicating that no data is returned, as a parameter indicating that no arguments are passed in (not required in C + +), and can be used as pointers.
Volatile.

Volatile (unstable) qualifies an object to be changed by an external process (operating system, hardware, or concurrent thread), and the syntax for the declaration is as follows:

int volatile nvint;

Such declarations are not the most efficient because their values change at any time, and the system often reads and writes the value of the object when needed. This is often used in asynchronous processes such as interrupt handlers for memory cell access.
wchar_t.

wchar_t is a wide-character type with 2 bytes per wchar_t type and 16-bit width. The expression of Chinese character must use wchar_t.

Identifier

Definition: The names of variables, symbolic constants, functions, arrays, types, files, tags, and various other user-defined objects.

The first character must be a letter or an underscore

Subsequent characters can be letters, numbers, or underscores

The valid length of the identifier is no more than 247 characters

The identifier cannot be the same as the keyword

Identifiers are case sensitive
It is best not to have the same name as the system predefined identifier
Identifier name to do "see name known meaning"
You should avoid using letters that may cause confusion
Identifier name to do "see name known meaning"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.