C Language various keywords

Source: Internet
Author: User

1. Register

When a variable is defined within a function, the default is the auto type, the variable is stored in memory, and when the program uses that variable, the controller issues a command to send the value of the variable in memory to the operator, and then the data is sent from the operator to memory after the calculation is over. If a variable is decorated with the Register keyword, the compiler can store the variable in the internal registers of the CPU as much as possible, so that the variable is not accessed through memory addressing, which greatly improves access efficiency.

2. Volatile

Variable or address that is modified by the volatile keyword, the value of the variable or the value that the address points to is retrieved from memory each time it is used. If not modified with the volatile keyword, when the compiler optimizes, in the same process, when the last value of this address action is not changed in the process, he automatically fetches the last read data without re-fetching the contents from the memory address. This situation is often used in embedded systems, driver programming, and generally in the operation of registers or hardware I/O ports.

3. Inline

The inline keyword-decorated function is called an inline function, and at the time of program compilation, the compiler replaces the call expression for the function with the function body of the function as it appears in the program. Similar to macro replacement, but easier to understand than the macro, error-prone. The inline keyword is used to define functions that are short in function body code and frequently called, saving the time cost of frequent jumps of the function at the expense of increasing the target code.

4 、。。。。。。

C Language various keywords

Related Article

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.