1. Overview
After the const keyword is in C + +, the function of the macro definition constants is no longer recommended. This makes the macros seem useless. In fact, the macro can do a lot of things, the author is difficult to enumerate all. Here, just a few typical usage, I hope you can benefit from it.
2. Realize multi-environment compatibility
The common scenario is that we implement a function that wants it to only be satisfied in some kind of
In the final section of VBA learning, I would like to emphasize that to make good use of recording macros, Excel's Help and network search.
In the process of self-study VBA, I often say to use more-learn-think-more and Beginners self-study VBA also three big tools: Recording macros, VBA Help and network search. Make good use of these three kinds of words, many problems do not need the help of others can so
Excel 2013 Macro-enabled methods:
Enabling macros Step 1: Because the interface changes are still relatively large, so here also explains the location, open Office 2013 Excel, if you are not entered by the file, then we click on a "Blank Workbook":
Enable Macros Step 2: Click "File" on the menu bar, then select "Options", and in the Pop-up Options menu, click Trust Center settings in the Trust Cente
Macros in C language are used to indirectly operate the compiling environment.
C language: Before compiling the source program normally, explain some special preprocessing commands to generate a new source program, then perform the normal compilation (to obtain the intermediate file and add the parameter/p ).
In the source program, in order to distinguish preprocessing commands from General C statements, all preprocessing command lines start with a sy
Access using macro control program 3. Use Conditions in macros
Access using macro control program 3. Use Conditions in macros
In some cases, you may want to perform one or more operations in a macro only when the specified condition is true. For example, if a macro is used to verify data in a form, the corresponding information may be displayed to respond to certain input values of the record, and the o
The assert macro prototype is defined in the header file assert. in h, it is used to terminate the execution of the program if the condition following the macro returns false. The macro will call the _ assert_fail function, which first outputs error information to stderr, then, call the abort function to terminate the program execution.
1. assert macro definition
As follows:
[Cpp]# Define assert (expr )\(Expr )\? _ ASSERT_VOID_CAST (0 )\: _ Assert_fail (_ STRING (expr), _ FILE __, _ LINE __, _ A
PowerPoint custom operations to trigger malicious Payload instead of macros
When analyzing recent phishing attacks, we found that attackers started to use PowerPoint custom operations to trigger malicious Payload instead of macros. Although the use of PowerPoint attachments is not new, this attack is still interesting because they can bypass the Office attachments to enable Macro Controllers.
1. Attackers
C languageThe use of macros (macro) in macro C (and C + +) belongs to the scope of compiler preprocessing, which is a compile-time concept (not a run-time concept). The following is a simple summary of the use of macros encountered. About # and # #In a C-language macro, #的功能是将其后面的宏参数进行字符串化操作 (stringfication) is simply to add a double quotation mark to the left and right of the macro variable that it refers
Many Program Personnel do not know C What does "macro" mean? Especially When a macro has Parameters Macro and function are often confused. I want to talk about "macro" here ", Macro only A definition defines a statement block. When a program is compiled, the compiler first needs to execute an action to replace the source program and replace the macro reference with the macro-defined statement block, just like replacing a text file. This action term is "macro expansion ". Using
When writing code yesterday, you must obtain the current Compilation Time in the code to dynamically use the version information. Therefore, some predefined Macros in the C standard are used. Here we will summarize the following macros defined in the C standard:
_ Date _ Date of preprocessing (string text in the form of "Mmm dd YYYY", such as May 27 2006)_ File _ represents the string Text of the curre
An inline function is also called an embedded function.
Program .
Function calling requires the establishment of a stack memory environment, parameter passing, and program execution transfer, which requires some time overhead.
The Inline Function Definition in C ++ is very simple. You only need to add a keyword inline before a common function. In addition, there is no difference (including the function call method) with the ordinary function on the surface ), because of this, in the opinion of
The Inline Function Format is as follows:
Inline int FAC (int I) {return I * I ;}
Inline functions, like common functions, require reference type checks, but it is more efficient to execute inline functions than to execute common functions, because calls to inline functions do not need to be interrupted, inline functions are embedded into the target during compilation.CodeMedium.
Applicable scenarios:
1) the code is short and does not include loops.
2) need to be called repeatedly
The
A collection of non-MFC program trace and assert macrosWe know that the trace and assert macros come with the MFC framework program. But how can we implement these two Macros in a non-MFC program. Here is an implementation method. Implement these two Macros in the Debug. h file. The program can include this header file. The header file and description are as foll
We know that the trace and assert macros come with the MFC framework program. But how can we implement these two Macros in a non-MFC program. Here is an implementation method. Implement these two Macros in the Debug. h file. The program can include this header file. The header file and description are as follows:
# Ifndef _ debug_h _# DEFINE _ debug_h _
# Ifndef
How to Use Macros in C language, including Single and Double Well variable parameters
Favorites
Macros (macro) in C (and C ++) belong to the scope of compiler preprocessing, and belong to the concept of compilation period (rather than the concept of runtime ). The following briefly summarizes the frequently encountered macro usage problems.
About # And ##
In the macro of C language, # is used to stringize t
iOS uses macros to define functions and blocks of codeToday, in the development process, there is a problem: it is the parent class to send out notifications, and then in the subclass or other class to receive it. Of course, it is generally written into the class method, but there is a problem, that is, if the calling class is not its subclass, it can not be directly invoked, of course, it is also possible to implement the static method, I am here mai
v1--Single-parameter macros#define DRV_DEBUG 1#if DRV_DEBUG #define DRV_PRINT(x) printf(x)#else #define DRV_PRINT(x) #endifThis version of Drv_print (x) can only output a single variable--pure stringvoid foo(){ DRV_PRINT("Driver Initialize Success!");}Change the Drv_debug macro definition when you do not need to print debug information#define DRV_DEBUG 0Of course, you can define it directly.#define DRV_PRINT printfBut if the macro calls more tha
Visual Basic for Applications (VBA) is a macro language of Visual Basic that can be used primarily to extend the application functionality of Windows, especially Microsoft Office software, including Excel, PPT, Word, Outlook, and so on.
Excel documents developed with Excel VBA need to turn on Excel's macro functionality when running in Excel, otherwise the VBA Automation feature of this document will be completely masked and the document's functionality cannot be implemented.
Therefore, before
How do I implement data exchange between two cell ranges in an Excel table? Usually we use the Cut-and-paste method to do this, but this method is cumbersome, and error prone if the data area is larger. Let's try to write a "macro" that can implement that functionality.
On the Tools menu, open macros, select Record new macros, and in the Personal Macro Workbook (Personal.xls), create a macro called Ex
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.