| _ ioc_write (bidirectional ).The kernel defines the _ IO (), _ ior (), Iow (), and _ IOWR () macros to help generate the above cmd. The following describes the implementation of _ IO (). Others are similar:
You can see the definition of _ IO () in ASM-generic/IOCTL. h.:
# DEFINE _ IO (type, NR) _ IOC (_ ioc_none, (type), (NR), 0)
Let's look at the definition of _ IOC ().:
# DEFINE _ IOC (Dir, type, NR, size )\(DIR) (Type) (NR) (Size)
It can be see
description in section 6.10.3.1 of the standard is still clear, and it writes as follows:
after the arguments for the invocation of a function-like macro have been identified, argument substitution takes place. A parameter in the replacement list, unless preceded by a # Or # preprocessing token or followed by a ## preprocessing token (see below), is replaced by the corresponding argument after all macros contained therein have been expande
declare_dynamic macro to the Class header file, and then include this module in all. cpp files that need to access part class objects. If delcare_dynamic and implement_dynamic macros are used as described, you can use the runtime_class macro and cobject: iskindof function to determine the object class during running time. If declare_dynamic is included in the class definition, implemetn_dynamic must be included in the class tool.
Declare_dyncreateDec
1. Question:
C ++ rtti lacks some runtime information and cannot directly create an object based on the object name. To achieve serialization, MFC constructs its own rtti information from the ground up and defines a set of macros. For details, refer to the implementation of the following classes and Macros in the MFC source generation:Cruntimeclass, cobject, declare_dynamic, implement_dynamic
2. Requirement
Some predefined macros are specified in the C standard and are often used in programming. The following table lists some predefined macros that are frequently used.
_ Date _ Date of preprocessing (string text in the form of "Mmm dd YYYY)
_ File _ represents the string Text of the current source code file name
_ Line _ represents the integer constant of the row number in the current source code.
_ Time _
macro to the Class header file, and then include this module in all. CPP files that need to access part class objects. If DELCARE_DYNAMIC and IMPLEMENT_DYNAMIC macros are used as described, you can use the RUNTIME_CLASS macro and CObject: IsKindOf function to determine the object class during running time. If DECLARE_DYNAMIC is included in the class definition, IMPLEMETN_DYNAMIC must be included in the class tool.DECLARE_DYNCREATEDECLARE_DYNCREATE (c
)__attribute__((aligned (n)))To align the structure members to the natural boundary of n Bytes. If the length of a member in the structure is greater than N, the maximum member length is used for alignment.4)__attribute__ ((packed))Cancels the optimization alignment of the structure during compilation and alignment according to the actual number of bytes occupied.The first method above n = 1, 2, 4, 8, 16... is more common.
#define CACHE_ALIGNED __attribute__((aligned(CACHE_ALIGN_SIZE)))3.
Variab
Implement TODO macros by yourself//turn into a string#define STRINGIFY (S) #S// macros that need to be solved two times before they can be solved#define DEFER_STRINGIFY (s) stringify (s)#define PRAGMA_MESSAGE (msg) _pragma (stringify (MESSAGE (msg))// to beWarningAdd more information#define Formatted_message (MSG)"[todo-]defer_stringify (__counter__)"] "MSG"\ n"defer_stringify (__file__)"line"defer_stringif
You can use macros to define "functions" without return values ". For example:
# Define printmax (A, B)/do/{/INT x = A, y = B;/printf ("MAX: % d/N", x> Y? X: Y); //} while (0) //... printmax (3, 4 );
Such a "function" is essentially different from a function in the true sense, because a macro is a pre-compilation behavior and only replaces the text before compilation. In Python source code, we often see macro definitions similar to the following:
Part I: Macro basics A macro is simply a text substitution tool in the C preprocessing phase, which is not visible to binary code after compilation. The basic usage is as follows: 1. Identifier aliases #define BUFFER_SIZE 1024 preprocessing phase, Foo = (char *) malloc (buffer_size);//is replaced with foo = (char *) malloc (1024); Macro body wrapping requires a backslash at the end of the line #define NUMBERS 1, 2, 3 preprocessing phase int x[] = {numbers};//is expanded to int x[] = {1, 2, 3}; 2
Some predefined macros in the C language standard
The C standard specifies some predefined macros that are often used for programming.The following table is a list of predefined macros that are often used.
__date__Date for preprocessing (string literals in the form of "MMM DD yyyy")
__file__string literal representing the current source code file name
__line_
Small series The last time you start word2007, always prompt "Security warning macros have been disabled," but where is this macro? turned the word option over and over, didn't find it! After a burst of Baidu, Google big search just know in the "Trust Center Settings" inside a "macro settings", add this setting is Office A security defense initiative designed to prevent malicious code from using macros to a
MacroOur calculator program, with 1234 corresponding to subtraction, is a bit of a hindrance to people reading. After one months to look at this code may not be able to think of 0123 or 1234, but also to find in the code, if you can represent the four number of arithmetic to take a meaningful alias, a look is to know what corresponds. No problem, use a macro. The following is the fifth edition of our Calculator program://define arithmetic macros#defin
program in or out of the compilation commands, such as # if and #ifdef, and usually converts the excluded statement to a blank line.(3) Macro expansionThe preprocessor expands the macro reference that appears in the source program file into the corresponding macro definition, which is what this article describes as the function of # define, which is done by the preprocessor.The source program processed by the preprocessor differs from the previous source program, where the work performed is pur
1. Hybrid macros.
As styles become more and more complex and require repeated use of large sections of styles, using variables cannot achieve our goal. At this time, the mixed macros will be used.
When using a hybrid macro, you must first declare a hybrid macro. When declaring a hybrid macro, there are two types: A Mixed Macro without parameters and a Mixed Macro with parameters.
1.1Declaration of mixed
ZZ from:http://blog.csdn.net/musein/article/details/742609==================================================The __init and __exit declarations is special kernel macros designed to tell the kernel to flag thesefunctions for special handling in cases where they is compiled in statically rather than included asparts of modules.The __init declaration allows the kernel to reclaim the space used by initializationfunctions, while the __exit declaration tells
Compilation: assemblyGuess: So this macro is related to the assembly?!Reference: Some of the constant macros are referenced by both C and ASM, while C and ASM differ in the processing of the immediate number symbol . In ASM, directives are adopted to differentiate whether the operands are signed or unsigned, rather than through the operands. and C is through the property of the variable, not through the operator. c If you want to indicate that a cons
expansionThe preprocessor expands the macro reference that appears in the source program file into the corresponding macro definition, which is what this article describes as the function of # define, which is done by the preprocessor.The source program processed by the preprocessor differs from the previous source program, where the work performed is purely a substitution and unwinding, without any computational function, so as long as you can really understand this when learning the # define
The system supports macros by default:Https://www.zabbix.com/documentation/2.0/manual/appendix/macros/supported_by_location?s []=macrosTo define a global macro:Administration--general--macros650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7F/95/wKiom1cjGWHBAfbgAABUDgR7WQw023.png "title=" 1.png " alt= "Wkiom1cjgwhbafbgaabudgr7wqw023.png"/> can also define macr
Today's small series to introduce you to the Excel macro settings method, I hope to help you students.
Excel Options Setting macros
Click the Office Button, and then click Excel Options:
Click Trust Center, and then click Trust Center Settings:
After you click Macro Settings, select the appropriate option, and then click OK below to confirm the macro settings:
Save the file as a macro-enabled table
Click the S
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.