C ++ keywords

Source: Internet
Author: User
C ++ keywords
Asm Double New Switch
Auto Else Operator Template
Break Enum Private This
Case Extern Protected Throw
Catch Float Public Try
Char For Return Typedef
Class Friend Register Union
Const Goto Short Unsigned
Continue If Signed Virtual
Default Inline Sizeof Void
Delete Int Static Volatile
Do Long Struct While

The red part is unique to C ++, and the black part is a common part of C ++ and C.

Key Parts:

VolatileUsage:

1) Hardware registers of parallel Devices

2) Non-automatic variables that will be accessed in a terminal service subroutine

3) variables shared by several tasks in multi-threaded applications

In this thread, when reading a variable, in order to improve the access speed, the compiler sometimes first reads the variable to a register during optimization. When the variable value is obtained later, the value is taken directly from the register. When the value of a variable changes in the current thread, the new value of the variable is copied to the register at the same time to maintain consistency. However, when the value of a variable is changed due to other threads, the value of this register will not change accordingly, resulting in inconsistent values read by the application and the actual value of the variable.

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.