In C and C + + languages, an identifier is allowed to represent a string, called a macro, which can be a constant, an expression, a string of formatting, and so on. When compiling preprocessing, all occurrences of the "macro name" in the program are substituted with the string in the macro definition, which is called "macro
(a) Symbolic constantsA macro definition is a substitution policy in C that uses a preprocessing command #define equate a string (lengthy) text with a name (called a macro) and then use the macro in bulk in the source code. In the preprocessing phase, replace the macros in the source code with the original text. For example, in the source code:#define PI 3.14T
" H.264/AVC Video Codec technology detailed" video tutorial has been in the "CSDN College" on-line, the video details of the background, standard protocol and implementation, and through a practical project in the form of the standard of the resolution and realization of H. A, welcome to watch.
"The paper came to the end of the light, I know this matter to preach", only by themselves in accordance with the standard document in the form of code to operate, in order to the video compression codi
Whim:In a language to write C + + plug-in, can replace the macro definition,You can do this by adding specific tags to C + +, such as The middle code can be translated into C + + code and compiled with the C + + compiler.Bothered:1.c++ macro must be anti-slash, and then need a lot of repetitive logic code, the need for macros to reduce the amount of code, to achieve efficient work;2. If there is a large num
This article first introduces Linux under the Classic macro definition, feel the wisdom of the geek, and then according to the classic definition for the next blog to pave the groundwork.Offsetof MacroDefinition:Gets the offset of the variable member (MEMBER) of the struct body (TYPE) in this struct. #define OFFSETOF (Type, MEMBER) ((size_t) ((TYPE *) 0)->member)Description: Gets the offset of the variable member (MEMBER) of the struct body (TYPE) in
First look at the macro definition of __user:
#ifdef __checker__# define __user __attribute__ (Noderef, Address_space (1))
As you can see from the macro definition, the __user macro definition is valid under the condition that you configure the __CHECKER__ macro, and it is obvious that the
1. Rules and usage resolution for macro definitions(1) The parsing rule of a macro definition is that it is replaced by a preprocessor during the preprocessing phase, and the substitution is unchanged.(2) The macro definition substitution is performed recursively until the replaced value itself is no longer a macro.(3)
In GNU C, a macro can accept a variable number of arguments, just like a function, such as:
12
#define pr_debug(fmt,arg...) \ printk(KERN_DEBUG fmt, ##arg)
Passing variable parameter tables with variable-parameter macros (Variadic macros)You may be familiar with the use of variable parameter tables in functions such as:
1
voidprintf(constchar* format, ...);
Until recently, a mutable param
#springMessage ("xxx") to deal with internationalization:The way spring handles internationalization can be very special, because this tag can be used.This tag is used only after spring has integrated the velocity template. This template is available in:Org.springframework.web.servlet\src\main\java\org\springframework\web\servlet\view\velocity\spring.vmThe first macro in the velocity template is the springmessage tag, and there are other markers, whic
In the book or the novel print, you do not set reverse order printing, then the paper will need to be rearranged, because the first page is placed in the bottom, many words obviously not that time to another one of the tune. Here's how to use the macro method to solve Excel table in reverse order printing.
Start the Excel table and click View-Macro-to record the macro
Macro definition that contains if
When the macro definition contains an IF
1) define the following macros#define DC (P) if (foo (p)) fun (p)
Used in the following environment
if (k>n)
DC (k);
Else
DC (n);
After the macro is replaced, the following
if (k>n)
if (foo (k))
Fun (k);
Else
if (foo (n))
Fun (n);
Visible, the original if and else are no longer paired.
Recently, because of the beginning of the real use of the new Tang M051, began to understand the new Tang M0 especially the charm of M051. Learn the official good intentions. Experience the unique charm of m0+51, yes, he is to mess up the 8-bit machine market, the goal is to become and 8051 comparable to the single-chip microcomputer. He did it. Many people in the AVR era, feel that the port alone assignment is inconvenient: for example-
Two X LCD ports:
Lcd_clk
Lcd_dat
To pull high and low, a l
"Experimental Purpose"1) Learn about macro viruses2) How to learn macro virus"Experimental principle"Macro viruses are malicious programs written in macro language (VBA) that exist in Word-processing documents, spreadsheets, databases and other data files, such as Office data Processing systems, which use the functions
Special Symbol #, # #(1) # When you put a # Before of argument in a preprocessor macro, the preprocessor turns that argument into a character array.Using a # in front of a parameter in a macro, the preprocessor converts this argument to an array of characters Simplified understanding: #是 The meaning of "string", which appears in the macro definition # is to conve
Summer, is a "virus" season, computer viruses are no exception, especially the risk factor is very large Doc virus (virus macro virus) is the use of IE browser access to the network on the Doc page, will also be inexplicably to "black" a. So what is doc exactly a virus ah, it is how black their own baby computer it? Now let's take a look at what the doc virus looks like.
Macro virus, it is a special virus
[Switch] DEFINE introduction and multi-row macro definition in C language, define multiple lines
[Go] DEFINE introduction and multi-row macro definition in C LanguageTo write a good C language, a beautiful macro definition is very important. Macro definition can help us prevent errors and improve code portability and r
For a complete description of macros and inline functions, see
Http://wenku.baidu.com/view/dbf9051c59eef8c75fbfb39f.html
This article from http://hi.baidu.com/liugang585570/blog/item/83fa38f9c9d8fd04d8f9fd04.html
Before introducing inline functions, it is necessary to introduce preprocessing macros. The functions of inline functions are similar to those of preprocessing macros. We believe that we have used preprocessing macros. We often define some macros, such
# Define table_comp (
Referrence:
Http://gcc.gnu.org/onlinedocs/cpp/Argument-Prescan.html#Argument-Prescan
Procedure
Macro_expand (macro (argv)/* macro extension process with parameters. The macro is macro and the parameter is argv */{/*. If the macro is defined as a
Macro usage, usePreface
Macros play a major role in C/C ++.
Keywords
Several Functions of macros
1. Define Constants
2. Define an expression
3. Simplify tedious code
4, as the identifier
5. variable parameters
6, # And #
1. Define Constants
For example, you can use a macro to define the PI value.
#define PI 3.1415927
2. Define an expression
#define MAX(a, b) (a>b?a:b)
3. Simplify tedious
When writing a Graph template class, in order to enable the user to customize the type of distance, such as int or double or even other high-precision rational number encapsulation class,I defined the type of distance as template parameter t_dist and used library functions in the standard librarySTD :: numeric_limits t_dist : : Max ()To define the maximum distanceTemplateTypeName t_dist>ConstTypeNameTopologicalgrapht_dist: :DistanceTopologicalgrapht_dist: :max_distance= (STD::numeric_limitst
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.