Black Horse programmer ___ preprocessing command

Source: Internet
Author: User
Tags processing instruction

------ Java training, Android training, IOS training, and. Net training. We look forward to communicating with you! -------

1. Preprocessing commands are operations performed before the code is translated into 0 and 1.
2. Pre-processing commands start with # And can be written at random.
3. The pre-processing instruction scope starts from the preparation of the instruction to the end of the file, but the # UNDEF can cancel the macro definition.

I. macro definition

1. Definition: # define kcount 4. macro names generally start with uppercase or K, and variable names generally start with lowercase letters.
2. application Scenario: If a variable is frequently used, we can use macro definitions, such as PI and circumference rate. The advantage is that it can improve program performance and save memory, the macro definition is executed before the code is translated into 0 and 1, so the system will not allocate space.
3. macro definition knowledge is simply replaced and not responsible for computing. macro definition with parameters is more efficient than Function

Ii. Conditional compilation


1. Definition

# If (condition)
# Elif (condition)
# Endif

# Ifdef
# Endif

# Ifndef
# Endif
This definition is generally used at the beginning of the header file, which can prevent files from being # include multiple times and control performance.

2. conditional compilation is generally used together with macro definition. It can be used to compile a piece of code. Sometimes, when the conditions are not met, Conditional compilation can be used without compiling a piece of code, it can greatly improve the program performance.

3. File Inclusion


1. Keyword # include, which is generally used at the beginning of a file, indicates that if you want to use a file, you can use # include, which is equivalent to a copy.
2. If the system file is used, use # include <>. If the file is used for self-writing, use # include "".

Black Horse programmer ___ preprocessing command

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.