Objective:1) output log is a large loss of system performance2) The information that is output is easily intercepted, causing the information to be unsafe.So we're going to cancel all of the logs in the release version (release). It is obviously not a clear choice if you are going to comment out the log one line at a line.So we can use macros to customize the log output.One of the simplest examples:#ifdef debug# define Gclog (FMT, ...) NSLog (FMT), #
string during C program Compilation
# Define max (A, B) (a)> (B ))? (A) :( B)
5. Macro limitations
1. Macros cannot access private members of objects.
2. The definition of macros is prone to ambiguity.
Example of ambiguity:
# Define table_multi (x) (x * X)
Table_multi (10) // 100 is returned, which is correct.
Table_multi (10 + 10) // The expected result is 400, while the macro call result is (10 + 10*1
Http://www.dotnetperls.com/post-pre-build-macros
You need to use post-build and pre-buildMacrosIn Microsoft Visual Studio 2008. You may have two projects that rely on each other but are separate. We can write a macro to copy files from one project to another after the first one is built.
This page provides an example of using build macros with a DLL in Visual Studio.
For the original article, see here
Macro, a small piece namedCode. InProgramWhen this name is referenced elsewhere, the compiler will automatically replace it with macro content. There are two types of macros. Their differences are mostly manifested in the Code:Object-likeMacros refer to objects, whileFunction-likeMacro refers to function call.
You can define any valid identifier as a macro, connectedC LanguageCan also be reserved, because the Prepr
Meanings of commonly used Macros in Visual C ++ MFCAnd_catchand_catch and_catch (exception_class, exception _ object_point_name) Description:Define Code Block, which is used to obtain the additional exception type in the current try block. Use the catch macro to obtain an exception type, and then use the and_catch macro to obtain the subsequent exception handling code. You can access the exception object (if appropriate) and have more messages about t
C/C ++ zhonghong summary CProgramOfSource codeVarious compilation commands can be included. These commands are called preprocessing commands. Although they are not actually part of the C language, they extend the C programming environment. This section describes how to use preprocessing programs and annotations to simplify the program development process and improve the readability of the program.Macros are not part of the C/C ++ language and are pre-processed by the processor before compilation
Document directory
Copy attribute name to definition using macros in ER/studio
Copy attribute name to definition using macros in ER/studio
Recently, when processing the SQL script generated by ER/studio, we found that if the definition is not defined, there will be no table and field comments after the SQL script is generated.Therefore, a macro is written to implement this function. The Code is as follow
1. Macros① no macros #define MAX ② macros are precompiled when you replace them③ Plain capitalization definition macrosThe main function of the ④ macro is to replacethe use of ⑤ macros makes the program easier to modify2. Conditional compilation① function: Compile different code according to different conditions② typic
This article by larrylgq prepared, reproduced please note the Source: http://blog.csdn.net/larrylgq/article/details/7395261
Author: Lu guiqiang
Email: larry.lv.word@gmail.com
Lisp uses special operators to extend the syntax, but the number of special operators in lisp is fixed. To solve this problem, LISP introduces macros, which do not directly do things, but generate actual services.Code.
Evaluate a macro: If the received S-expression
Some predefined Macros in the c StandardFrom: http://www.wangchao.net.cn/bbsdetail_149674.html
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.MacroMeaning _ Date __ Date of preprocessing (string text in the form of "Mmm dd YYYY)_ File __ Rep
Macros and functions and comparisons in C + +:1, frequent use and perform simple calculations can use macros, and other more cumbersome, complex programs can be implemented with functions.2, the macro definition is independent of the type, and the function needs to pay attention to the type of parameters.3, the name of the macro definition is all uppercase, and the function name is the use of letters and "_
]bounds]. size.width==320.0f[[uiscreenmainscreen]bounds].size.height ==568.0f// Judging whether it is iphone6/6s#defineiphone6_6s[[uiscreenmainscreen] Bounds].size.width==375.0f[[uiscreenmainscreen]bounds]. size.height==667.0f// Judging whether it is iphone6plus/6splus#defineiphone6plus_6splus[[ uiscreenmainscreen]bounds].size.width==414.0f[[uiscreen Mainscreen]bounds].size.height==736.0f//getting the system version #defineios_system_version[[[uidevicecurrentdevice] Systemversion]floatvalue]14.
In iOS development, it is often used to define macros, or to modify some data types with const, and often developers do not know how to use them correctly, resulting in the confusion of macros and const decorations in the project.Can you tell the difference between the following? Do you know when to use it?#define Hscoder @ "Hansha haha"NSString*hscoder = @"Hansha haha";extern NSString*hscoder;extern Const
Use of trace macros in C + +
Trace macro for VC under the program debugging is very useful things, with a similar function of printf, the macro is only in the debug version of the program appears, when the release of the macro disappears completely, thus helping you debug also in the release of the time to reduce the amount of code.The use is very simple and the format is as follows:TRACE ("ddddddddddd");TRAC
Macros are a collection of commands and are widely used, including the word editor in MS Office, the Excel editor and various text editors, and Vim, one of the most powerful text editors in Linux systems, also supports macro operations, and this section briefly describes the use of macros in Vim, First look at the following macro commands
q* Start Recording mac
In Word, although it's not easy to create macros, it's really easy to run a macro, just like a program has been created, so we just need to turn on the switch, so what's the simple step?
Word
1, click Macros from the Macros submenu on the Tools menu.
2. In the Macro name box, click the macro: an action or a set of actions that you can use to automate ta
There are several main differences between enumerated constants and macros:
1. an enumerated constant is one of the entities, but the macro is not an entity;
2. an enumerated constant is a constant, but a macro is not a constant;
3. an enumerated constant has a type, but the macro has no type, and the enumeration variable has the same scope, value, and other properties as the normal variable, but the macro is not, and the macro is not part of the l
It is not convenient to invoke macros by running the Macros dialog box, call macros through shortcut keys, and if you can't remember the macros, add a button.
If the macro is valid only for the current workbook document, I recommend that you add a form command button to the workbook document to invoke the macro:
1. E
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.