Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - What does #ifdef #define mean?
What does #ifdef #define mean?
What does #ifdef #define mean? Compile preprocessing structure

#ifdef ...

# Definition ...

#endif ...

To help you understand, let's give an example of ARM:

# ifdef _ DMA 1 _ channel 1

# define DMA 1 _ Channel 1((DMA _ Channel _ TypeDef *)DMA 1 _ Channel 1 _ BASE)

# endif/* _ DMA 1 _ channel 1 */

This is a ST library function.

If you want to use the address DMA 1_Channel 1 for your own programming, that is, ((DMA _ channel _ typedef *) DMA1_ channel1_ base), you only need it in the header file of your own function.

Add a sentence # define _ DMA1_ channel1.

Then it is also possible to include this library function.

What does ifdef mean? #ifdef is a computer program statement.

It can be used to distinguish some codes related to specific header files, libraries and other file versions.

If the macro defines the statement 1, program 2 will be executed.

What do you mean #ifdef __APPLE__ #ifdef is a precompiled command.

This means that if the symbol __APPLE__ is defined in the program, the following statement is compiled (before #endif or #else).

What does #ifdef _MSC_VER mean? The VC++ program you asked is used to indicate the version number of the program and has no practical use.

What does the definition mean? Definition.

English [d]? Law? Beauty [d? ] method? n]

Definition; Find out; rule

(definition) name; (British) Devan; Definition (Portugal)

[past tense definition past participle definition present participle definition]

English explanations and examples:

If you define something, you clearly show, describe or state what it is, what its limit is, or what it is like. Define ...; explain

Example:

The Convention against Torture defines torture as any act that causes severe pain or suffering physically or mentally.

The Anti-Torture Treaty defines torture as any act that causes serious physical and mental pain and suffering.

Sometimes, for the universality of the program, you can use # #define to preprocess macro definition commands, and its specific function is to facilitate the definition and modification of program segments.

For example, if you are working on a project, the code of this project is very long, with more than 5,000 lines, and basically the same constant n accounts for more than 3,000 lines. If you want to modify the value of this constant n in the future, if a # #define N is not defined at the beginning of the program, it is not very troublesome to modify it, with more than 3000 lines. That's not dizzy ~ if a # define n' constant value' is defined in advance, then when you want to modify the constant value inside the program, just modify the constant value after n, which is equivalent to changing the same constant value inside the program, which is very convenient.

The quantity whose value can be changed in the process of program execution is called variable, and the types of variables are divided into system variables and user-defined variables. In fact, user-defined variables have the same meaning as system variables. When you learn structured programming, you will understand the meaning of custom variables. There are four kinds of system variables: int integer variable, stored by users, accounting for 4 bytes; Float single-precision floating-point type, which is used to store the value of decimal point, accounting for 4 bytes; Double high-precision floating-point type, compared with float, double decimal is more accurate, accounting for 8 bytes; Char character variable, mainly storing letters, accounting for 1 byte.

The word "define" means "definition". You should be talking about the macro definition in C language.

Define, the general form of a parameterless macro definition is: #define identifier string.

The define function defines a constant.

Constants are similar to variables except that:

After setting, the value of the constant cannot be changed.

A dollar sign ($) is not required at the beginning of a constant name.

Range does not affect access to constants.

Constant values can only be strings or numbers.

Function:

Identifiers defined as macros are called macro names. When compiling and preprocessing, all the "macro names" in the program are replaced by strings in the macro definition, which is called "macro replacement" or "macro extension". Macro definition is completed by macro definition commands in the source program. Macro replacement is done automatically by preprocessor.

The scope of macro definition is limited to the current file, that is, the definition of #define PI 3. 14 in file 1.c, but it doesn't work in file2.c; By defining #define PI 3. 14 in mon.h and # include "mon.h" in file 1.c and file2.c respectively, the macro definition is valid in file 1.c and file 2.c. ..

In C or C++ language, "macro" can be divided into parametric and nonparametric types.

rule

[English] [d? Law? N][ America ][d? Law? n]

transitive verb

Provisions; Find out; Accurate explanation; Draw the lines of;

intransitive verb

Define (words, phrases, etc.). ) form a definition;

network

Explain; Limit; Definition;

Third person singular: define present participle: define past tense: define past participle: define

1

Please let me explain your responsibilities.

Please listen carefully when I elaborate on your duties.

2

It is important to define the o term.

How to define "austerity" and "growth" is very important.

What does the definition mean? Defined as.

be defined as

Bilingual example

1

These elements can be easily defined as Eclipse core expressions in plug-in xml files.

These two elements can be easily defined as Eclipse core expressions in plug-in xml files.

2

The beauty of our country, or at least the beauty of the whole northern Scotland, is difficult to define because it is easy to appreciate.

The beauty of our country, at least all the places south of North Scotland, is easy to appreciate but difficult to describe. (Direct choice: appreciation is easier than explanation. )

What does #ifdef mean in VC? When the identifier is defined (usually defined with the #define command), compile the program segment 1, otherwise compile the program segment 2.

#else part can also be omitted, that is:

#ifdef

Program segment 1

#denif

The "program segment" here can be a statement group or a command line. This conditional compilation can improve the universality of C source program.