In gnu c, macros can accept variable parameters, just like functions, such:# Define pr_debug (fmt, arg ...)/Printk (KERN_DEBUG fmt, # arg)
Use variadic macros to transmit Variable Parameter tables You may be familiar with Using Variable Parameter tables in functions, such:
Void printf (const char * format ,...);
Until recently, variable parameter tables can only be applied to real functions and cannot be used in macros.
The C99 compiler standard has finally changed this situation. It allows you
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
ASP. net mvc Tip #16-create an ASP. net mvc macro operationASP. net mvc Tip #16-create ASP. net mvc macros
Original American: http://weblogs.asp.net/stephenwalther/archive/2008/07/09/asp-net-mvc-tip-16-create-asp-net-mvc-macros.aspxHttp://www.cnblogs.com/mike108mvp
Note: The translation level is limited. If there are any mistakes or mistakes in the translation, you are welcome to criticize and correct them. Thank you.
In this post, I will dem
In the C and C + + languages, an identifier is allowed to represent a string, called a macro, which can be a constant, an expression, a format string, 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
(i) Symbolic constants
A macro definition is a substitution policy in C that uses a preprocessing command #define equate a string of (verbose) text with a name (called a macro), and then you can 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:
#def
Ios7: Random Talk#defineMacro definition#define宏定义在C系开发中可以说占有举足轻重的作用. The underlying framework does not have to say, in order to compile optimization and convenience, as well as cross-platform capabilities, macros are heavily used, it can be said that the bottom of development left define will be unable to move. When developing at a higher level, we put more emphasis on business logic and seem to have little use and reliance on macros. But the benefits of using
C language-Address Book, C language address bookBlack/white address book -- 1 -- Requirement Analysis1.1 requirements1.2 prototype display1.3 Function Analysis-- 2 -- code implementation2.1 external declarations, variables, macros2.2 module implementation
[Written at the beginning :]
"The UI interface is used to it. It's pretty good to use a command line Address Book
1. How do I differentiate between macro names and macro strings in a macro definition? What should I pay attention to for macros with parameters?
In a macro definition, the macro name and macro string are distinguished by spaces.
icons or graphics. Using these macro definitions, the self-describing capability of the program is greatly enhanced. The above example can be changed:
static unsigned short stopwatch [] = {S _ x _, S _ x, S _ x, S _ x _, S _ x __, S x _, S x _, S x _, S x _, S x _, S _ x __, S _ x _, S _ x ___, S _ x _, S _ x ______, S _};
Obviously, it means more obvious than the previous code. The standard C language has octal, decimal, and hexadecimal constants
The execution process of inline functions is similar to the macro definition with parameters, but the processing of parameters is different. Macro definitions with parameters are not calculated, but replaced directly.
Inline functions are functions first, which means that many of the functions are suitable for inline functions. That is, inline functions evaluate the parameter expressions first,
Then pass th
The execution of an inline function is similar to a parameter macro definition, but the parameters are handled differently. The macro definition with parameters does not operate on the parameter, but instead, the inline function is the function, which means that many properties of the function are applicable to the inline function, that is, the inline function evaluates the argument expression first, and th
1, preprocessing instructions
(1) Concept: C language in the source program before compiling, will first of some special preprocessing instructions to explain (such as #include
(2) Preprocessing instructions are all preceded by "#" and do not end with a semicolon.
(3) Preprocessing instructions can be placed anywhere in the file, his scope is from where it appears to the end of the file, we often put it in the source program head, so that its scope is the entire source program file.
(4) Preproce
[C language crazy handout] (16) C language simple Address Book (not optimized version), handout address book
Knowledge points used in Address Book Development
Usage of constants and variables
Global Variables
Branch statement
Function
Macro
Loop statement
Scanf and printf
Data
Struct
File
Pointer *
Classic problems
Macro alternative solution in C ++
Macro is a god in the C language and can play with various tricks. It is also because of this that it will cause a lot of troubles to ordinary programmers. Since macros only work in the pre-compilation phase, the compiler cannot detect the bugs. As a new C ++ programmer, it is better to stay away from them.
C ++ provides some alternative solutions for macros.
1. Constant
Solo windLinks: C Language macro definitions (2)1. How do I distinguish between macro names and macro strings in a macro definition? What should be noted for macros with parameters?In the macro definition, the macro name and
Introduction to preprocessing Directives1.C language before compiling the source program, some special pre-processing instructions (such as the previous use of the # include directive) to produce a new source program (this process is called the compilation preprocessing), and then the usual compilation2. In order to differentiate between preprocessing directives and generic C statements, all preprocessor directives begin with the sign "#" and end without semicolons3. A preprocessing instruction
My previous question stopped for a long time because-I went to write a book.ObjectiveI started working in March 2012 and now I'm six years away. For the past six years, I have never known anything about SQL Server, only the simplest C # programmers have started, stepping back from a nameless outsourcing company to the middle of a larger financial institution, with wages rising to nearly four times times the size of a new job. In the process of struggle, I also go a lot of detours, once very depr
Many C ++ books advise us that C language macros are the first of all evil, but things are not as bad as we think, just like Goto. MacroA major role is to automatically generate code for us. If the template can generate various types of code (type replacement) for us ),In fact, macros can generate new Code (replacement and addition of symbols) on the symbols ).
You can find some macro Syntax problems on Google. Believe me, you do not know as much abou
In C ++, although using macros is not recommended, macros often provide us with some convenience, and there are indeed a large number of Macros in the existing code. Some people think that macros are the root cause of errors, because some strange code may appear after macros are expanded, so this article will summarize some methods to view the code after macros are expanded.
1. in Visual Studio 2005, select project Properties> Configuration Properties> C/C ++> Preprocessor, and select generate
The macro in the forum. C/C ++ summarizes various compilation commands in the source code of the C program. 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. The C language Preprocessing Program d
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.