16.4.2 me the basic idea of this set of macros
The main idea of this set of macros is: Use Word "endnote + cross-reference" to create an automated numbering system. In order to reduce duplication of work, written "macro", and made "button", so that "n-step operation, 1-click to solve."
16.4.3 inserts 1 new document numbers
(cursor moved to "after text to insert document Number": Suggest you move to the 5
① Click the menu bar-view-macros-to view the macros.
② Pop-up Macro interface, enter the name of the macro, here to facilitate memory, we named to move one column to the left, and then click the Create button.
③ in the new appearance of the interface, the input code, that is, the program language, I have written, you can copy directly.
application.screenupdating = False
x = Selec
You can use a macro to define a function that has no return value. For example:
Copy Code code as follows:
#define PRINTMAX (A, b) \ do \ {\ int x = A, y = b; \ printf ("Max:%d\n", x > y x:y); \} while (0)// ... Printmax (3, 4);
Such "functions" are essentially different from functions in real sense, because a macro is a compile-time behavior that replaces text only before it is compiled. In the Python source code, you can often see a macro definition similar to the follow
Preface
Export_symbol macros are used after Linux-2.6, in the Linux-2.4 kernel, the default non-static functions and variables are automatically imported into the kernel space and are not marked with Export_symbol ().
Then, after Linux-2.6, all symbols are not exported by default, so use Export_symbol () to mark them. the role of 1.export_symbol macros The functions or symbols defined within the Export_sym
The concept of macros is no stranger to me, but I never use macros, but I always use procedures (subroutines), because I think the macro will make the program longer, although it executes faster than the calling subroutine. So have been not too cold to the macro, until looking at the program of Lao Luo found a useful macro, it makes the program's writing more concise, intuitive, and beyond the concept of my
1. Macro definition function:Example: #define DO{EXP} while (0) and # define EXP What is the difference, where is the benefit?Define complex code to prevent errors such as semicolons, or mismatched parentheses. Like what:Defined:#define SWITCH (x, y) {int tmp; tmp= "x"; x=y;y=tmp;}When used:if (x>y)switch (x, y);else//error, parse error before elseOtheraction ();When you introduce a macro into your code, you will get an error by adding a semicolon.2. The difference between const and # define con
C Primer Plus (fifth edition) Study Notes-variable macros:... and _ VA_ARGS __, primer _ va_args _
1. _ VA_ARGS __
In P454, the parameters of the printf () output functions are variable. When debugging a program, you may want to define parameters as variable output functions,
The Variable Parameter macro is an option, for example:
#define DEBUG(X, ...) printf("Message", #X,":" __VA_ARGS__)
Where,... indicates that the parameter is variable, __va_args
Const in C is "hypocrite", "counterfeit", and did not play his role. ButIn C + + is a veritable.The reason is also mentioned above, that is, the constants defined in C + + are stored in the symbol table (key,value), do not allocate memory space, only when the address or defined as a global variable is used in other files to allocate memory space, we use constant constant name to access the constant when using only the constants in the symbol table, Changes to the constant values in the memory s
possible that the header file is contained in two different header files), the error occurs because the same class cannot be defined two times. Change the aaa.h slightly: #ifndef _aaa_ #define _aaa_ class AAA {}; #endif can avoid such a problem.because when you have already included this file, the _aaa_ will have a definition, then the #ifndef condition is false and the subsequent class definition will not be executed. #ifdef和 #endif must be used in pairs. Theoretically, it can appear anywhe
to put the first evaluation on the top, written like this.(Defn read-resource [Path] (with path clojure.java.io/resource slurp read-string))Everyone has a different preference, and some people still use it in order to reduce the number of brackets and their reading habits from left to right or from top to bottom.Binding macrosThe binding macro is used to create thread-specific variables that are commonly used in multiple threads.User=> (def ^:d ynamic x 1) user=> (def ^:d ynami
optional parameter, and then move the pointer backward, determine whether all parameters have been obtained based on the comparison with the end mark. Therefore, the ending mark in the va function must be agreed in advance. Otherwise, the pointer will point to an invalid memory address, resulting in an error.Here, the moving Pointer Points to the next parameter, so what is the offset when the pointer is moved? There is no specific answer, because the memory alignment problem is involved here, m
#,#@,## that appear in the C + + macro body:- # The function is to string the macro parameters behind it (stringfication), that is, it refers to the macro variable by replacing it in the left and right of each plus a double quotation mark-# # is called a connector (concatenator), which is used to connect two tokens to a token. Note that the object connected here is token, not necessarily a macro variable.Example:Creation of a layer in Caffe:#define Register_layer_creator (Type, CREATOR)
Properties ' VBA properties are features of VBA objects ' means of representing properties of an object are ' object. Property = property Value NBSP;NBSP;NBSP;NBSP;NBSP;NBSP;NBSP;NBSP;NBSP;NBSP;SUBNBSP;TTT () Range ("A1"). VALUENBSP;=NBSP;100NBSP;NBSP;NBSP;NBSP;ENDNBSP;SUBNBSP;NBSP;NBSP;NBSP;SUBNBSP;TTT1 () sheets (1). name= "worksheet renamed" endsubsubttt2 () sheets ("Sheet2"). Range ("A1"). value= "ABCD" EndSub NBSP;NBSP;NBSP;NBSP;NBSP;NBSP;NBSP;NBSP;SUBNBSP;TTT3 () range ("A2"). in
Start by inputting all the numbers (or exporting them) to the pound + number format, such as "#3333333323424234234234", and then run the following macro:Sub num2text () If not TypeOf application.selection are Range then MsgBox ' You must select Cells! ' Return End If for each cell in Application.Selection.Cells if cell. Text Macros used by Excel to set the cell to a number saved in text format in bulk
__VA_ARGS__ is a variable-parameter macro that few people know about this macro, which is the new C99 specification, and currently appears to be supported only by GCC (VC6.0 compiler does not support it).The implementation idea is that the last parameter in the argument list in the macro definition is an ellipsis (that is, three points). This way the predefined macro _ _va_args_ _ can be used in the replacement section, replacing the string represented by the ellipsis. Like what:#define PR (...)
__LINE__: The code line number in the current source file, a decimal integer.__FILE__: The name of the source file, the string literal.__DATE__: The processing date of the source file, the string literal. The format is MMM dd yyyy (MMM is the month, such as: Jan,feb, etc.); DD is a date in the form of a number from 01 to 31, a numeric date preceded by a space, and a yyyy is a four-digit year (such as 1994).__TIME__: The compilation time of the source file, the string literal. Its format is HH:MM
Definition of macro:#define KeyPath (obj, KeyPath) @ (((void) Obj.keypath, #keyPath))Example code:#import " ViewController.h " #define KeyPath (obj, KeyPath) @ (((void) Obj.keypath, #keyPath))@implementation viewcontroller-(void ) viewdidload { [super viewdidload]; NSLog (@ "keypath (Self.view, frame) =%@", KeyPath (Self.view, frame));} @endOutput:KeyPath (Self.view, frame) = FrameNote:This macro can be used in the use of KeyPath (after entering the Self.view, and then enter the char
http://blog.sina.com.cn/s/blog_4ca9ceef0101isv5.html//No use # # before it is this, each viewcontroller to write a duplicate code to write a lot of trouble/*********************** Pre-treatment *****************************/UILabel *titlelabel = [[UILabel alloc] init];Titlelabel. BackgroundColor = [Uicolor Clearcolor];Titlelabel. TextColor = [Uicolor Redcolor];Titlelabel. Text = @ "navigation bar title";Titlelabel. Font =[uifont Fontwithname:nil size:17.0f];[Titlelabel SizeToFit];Self.Navigation
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.