#define name [string]
Macro definition. When compiling preprocessing, all occurrences of macro names in the program are replaced with strings in the macro definition
... Variable parameter, used to pass a mutable argument list, you can use __va_args__ to get a mutable argument list
#define Debug (...) printf (__va_args__)#define Debug (format, ...) printf (format, __va_args__)#define Debug (format, ARGS ...) printf (format, args)
# string, enclose the corresponding parameter in double quotation marks
#@ single character, enclose the corresponding argument with the apostrophe, and treat it as a char (Microsoft specific)
# # Connect, connect two parameters together to form a marker
#defineToString (x) #x#defineToChar (x) #@x#defineConn (x, y) x# #yChar* str = ToString (1234);/*str = "1234"*/CharA = ToChar (1);/*a = ' 1 '*/intn = Conn (123,456);/*n = 123456*/Char* str2 = Conn ("Qwer","asdf");/*str2 = "QWERASDF"*/
< Span style= "color: #4e9a06;" >< strong> #line Number ["filename"]
#line used to reset by __line__ and __file__ The line number and filename specified by the macro
#line " LUKAS.C "/* line number is set to 1000, the file name is set to LUKAS.C */
< Span style= "color: #4e9a06;" >< Span style= "color: #0000ff;" > #error token-string
#if !defined (__cplusplus)#error C + + compiler required. /* If you do not use C + + compilers, then this line (except for annotations) will be printed */#endif
#pragma para
#pragma is used to set the state of the compiler or to instruct the compiler to complete some specific actions
Each compiler has a different implementation of #pragma, which is a machine or operating system-specific
#pragmamessage ("text")
ability to output response information in the Compile Information Output window
#pragma code_seg(["Section-name" [, "Sectio-class"]]
The ability to set the code snippet for the function code stored in the program is used when we develop the driver.
#pragma once
by Adding this command at the very beginning of the header file, you can guarantee that the header file will only be compiled once
compiler-related, poor compatibility. If you want to implement cross-platform, it is best to use #ifndef to replace
#pragma hdrstop
indicates that the precompiled header file ends, and the subsequent header files are no longer compiled
#pragma resource "*.DFM"
indicates that the resources in the *.DFM file are added to the project. *.DFM includes the definition of the form's appearance
#pragma comment(comment-type[, "comment-string"])
put a note record in an object file or executable file
comment-type Specifies the type of annotation, which is a predefined identifier and should be one of the Compiler,exestr,lib,linker
Compiler: Place the compiler's version or name into an object file, which is ignored by linker
exestr: Will be canceled in a later release
Lib: Connecting to a library file
linker: Specify a connection option so that it does not have to be entered at the command line or set in the development environment
Comment-string is a string that provides additional information for Comment-type
#pragma disable
declared before a function, valid only for one function, indicating that the calling procedure of the function will be non-interruptible
#pragma data_seg (["Shared-data"])
Create a new data segment and define shared data
Typically used to define a shared named Data segment in a DLL that can be shared by multiple processes in the data segment
#pragma data_seg ("Shareddata")/**/#pragma data_seg ()
#pragma region name #pragma endregion Comment
Visaul Special preprocessor directives in C + +, which allows you to collapse specific blocks of code
#pragma Region Variableshwnd hwnd; Const - ; // Other variables #pragma endregion This region contains global variables.
#pragma pack (n)
Specifies that the struct is aligned in N-byte
#pragma Pack (push)/* Saves the alignment state */ #pragma Pack (4)/* Set to 4-byte alignment */struct Test { char M1; double M4; int M3;}; #pragma Pack (POP)/* Restore Alignment status */
< Span style= "color: #8f5902;" >< Span style= "color: #8f5902;" >< Span style= "color: #8f5902;" > #pragma warning (...)
#pragmaWarning (disable:450734;once:4385;error:164)/*equivalent to*/#pragmaWarning (disable:450734)/* Do not display warning messages for numbers No. 4507 and 34th */#pragmaWarning (once:4385)/* Only report No. 4385 warning message once */#pragmaWarning (error:164)/* Take the 164th warning message as an error *//*Also , #pragma warning supports the following formats:*/#pragmaWarning (push[,n])/* Save the existing warning status for all warning messages and set the global warning level to n (1~4) */#pragmaWarning (POP)/* pops the last warning message to the stack *//*all changes made between the stack and the stack will be re-saved after the stack is out.*/#pragmaWarning (push)#pragmaWarning (disable:4705)#pragmaWarning (disable:4706)#pragmaWarning (disable:4707)/* ....... */#pragmaWarning (POP)/* resave all warning messages (including 4705,4706 and 4707) */
< Span style= "color: #0000ff;" > other preprocessing commands
#include file contains
#if x conditional Compilation
#elif x else if (x)
#ifdef x is equivalent to #if defined (x)
#ifndef x equals # If!defined (x)
#else
#endif
#undef x The scope of the terminating macro definition (x)
eof
C-Preprocessing commands