Discover how should calculate macros, include the articles, news, trends, analysis and practical advice about how should calculate macros on alibabacloud.com
,3,2,1,0)Calculate the number of variable parameters of the macro, the number of variable parameters is greater than 0, less than or equal to 3 within the range calculated correctlyFor example:1count_arg (x, y), 2count_arg (count_arg) , 3 with Count_arg Schematic calculation process Count_arg (x, y), Arg_n_helper (x,y,3,2,1,0), Arg_n (x,y,3,2,1,0) intercept fourth parameter 2Also, on the VC compiler, compilation may fail to define the following
First, we need to understand that when you access individual elements in a struct through struct variables, they are essentiallyaccessed by pointers, but this time the compiler helped us calculate eachThe offset between the element and the start address of the struct.One: Offsetof macro:#define OFFSETOF (Type, MEMBER) ((int) ((TYPE *) 0)->member)1: Parameter and return value analysis:(1) Type is a struct type, member is the element name of an element
Developed with VCProgramIt is best to use the verify macro instead of assert,
I didn't know why. Today I read the definition of two macros and finally understood it.
1. In debug mode, two macros have the same functions.
2. In the release mode, assert does not calculate the expressions in the parameters. Verify calculates the expressions in the parameters (if i
For a long time, macro definition # define is used to define some simple constants. At most, it is used to define a function. It seldom pays attention to macro definition usage. Until the following code is displayed:
#define PLAYSOUNDEFFECT(...) \[[GameManager sharedGameManager] playSoundEffect:@#__VA_ARGS__]
I have never thought about such a powerful usage before. Take a look at some iOS framework header files and find that almost all of them are macro-defined:
I have to say that macro defi
When you record a macro, you can click the toolbar buttons and menu options. However, the macro recorder cannot record mouse motions in the document window, and you must record these actions with the keyboard if you want to move the insertion point, select text, and scroll through the document.
If a dialog box appears during recording, Word will record the dialog box and record all the options settings for the dialog box only if the OK button or close is selected in the selection dialog box. Fo
Predefined macros,
Compilers usually provide different predefined macros for compiled programs based on different platforms and compilation options,
For example, Win32 win64 Linux, such as debug and release.
1. When using the GCC/g ++ compiler, you can run the following command to print the macros pre-compiled by the compiler.
Gcc-DM-e-
2. For details abou
If you want to serialize the macro parameter extension results, you must use two levels of macros.
1 # define xstr (s) STR (S) 2 # define STR (s) # S3 # define Foo 44 STR (FOO) 5 => "foo" 6 xstr (FOO) 7 ==> xstr (4) 8 ==> STR (4) 9 ==> "4"
When S is used in STR, S is stringized, so it is not a macro extension first.
However, S is a common parameter of xstr. Therefore, s itself has been expanded before the xstr macro extension is complete.
When STR
[ThinkingInC ++] 47. Regarding the Use of macros, we explored the disadvantages of using macros. thinkinginc47
/*** Book: [ThinkingInC ++] * function: describes the use of macros. * Time: 07:50:54, January 1, September 11, 2014 * Author: cutter_point */# include ".. /require. h "# include
Reasons for liking Wang Lihong
It can be said that I am a little similar
and print it out!
So we have the following story...
Compiler built-in macros:
First, we will introduce several built-in macro definitions of the compiler. These macro definitions can not only help us write cross-platform source code, but also help us output useful debugging information flexibly.
The ansi c standard has several predefined macros (which are also commonly used ):
_ Line __: Insert the current
Use of Conditional compilation macros and Conditional compilation macros
Jni is often used when writing code in cocos. Sometimes the class instance pointer is used in the c ++ code of jni.
1. define a global variable
# If (CC_TARGET_PLATFORM = CC_PLATFORM_ANDROID) GameInstance * gameInstance = nullptr; # endif
2. In the constructor
# If (CC_TARGET_PLATFORM = CC_PLATFORM_ANDROID) GameInstance * gameInst
1: Let's test and create an excel file, such as "haiguifurong1 ..2: If you want to enable the document, the following message is displayed: "macro disabled.3: click "OK".Table.4: as shown in the following figure, in "tools"-"security" settings, the effect is as follows.5: Go to the macro's "security"-"low"-"OK", and open the excel file again without being affected by the macro.Now you have successfully deleted the
/*** book: "thinkinginc++" * Function: about the use of macros, explore the disadvantages of using macros * Time: September 11, 2014 07:50:54* Author: cutter_point*/#include ". /require.h "#include "Thinkinginc++" 47, about the use of macros, explore the disadvantages of using macros
(_ gnuc_minor _> 2 |/(_ Gnuc_minor _ = 2 /_ Gnuc_patchlevel _> 0 ))Another approach is to use the predefined macros to calculate a single number, then compare that against a threshold:
# Define gcc_version (_ gnuc _ * 10000/+ _ Gnuc_minor _ * 100/+ _ Gnuc_patchlevel __).../* Test for GCC> 3.2.0 */# If gcc_version> 30200Please people find this form easier to understand.
_ Gnug __The gnu c ++ compiler defin
predefined macros to calculate a single number, then compare that against a threshold:
# Define gcc_version (_ gnuc _ * 10000/+ _ GNUC_MINOR _ * 100/+ _ GNUC_PATCHLEVEL __).../* Test for GCC> 3.2.0 */# If GCC_VERSION> 30200Please people find this form easier to understand.
_ GNUG __The gnu c ++ compiler defines this. Testing it is equivalent to testing (_ GNUC _ _ cplusplus ).
_ Strict_ansi __GCC defines
allowed to be expanded in the "draft", there is also a huge difference in the way it is expanded with the template. With this alone, we can deny the conclusion that "the essence of a template is macro. However, if we look more relaxed, can we think this way: although the template and macro adopt a completely different expansion method, if every Member in the template is regarded as an independent macro, can a template be implemented through a set of macros
Preface:
If you are familiar with C language, you should be familiar with macros. macros are often used in C language programming. The main purpose of using macros is to facilitate programming for programmers, in addition, the program efficiency can be improved to a certain extent. The macro definition command in C language is # define. The following are some sma
Preface:
If you are familiar with C language, you should be familiar with macros. macros are often used in C language programming. The main purpose of using macros is to facilitate programming for programmers, in addition, the program efficiency can be improved to a certain extent. The macro definition command in C language is # define. The following are some sm
Document directory
Code vs. Data
Homoiconicity, code = Data
Working with macros
Debugging macros
Code Templating
When to use macros
Using macros, for example
What is metaprogramming?
Metaprogramming is the use of code to modify or create other code.It is primarily a developer tool and acts as a force multiplie
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.