Knowledge Points:1. struct structs2.typedef keywords3. Definition of macros4. The difference between a macro and a function5. File inclusion and multi-file compilation6. Conditional compilation===========================Structural bodyThink: If you now want to save a student's information, name, height, age, address, how to saveChar name[64];float height;int age;Char addr[64];1. What is struct structstruct refers to a data structure, which is a kind o
[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
motives
A few days ago to see an interview question: Write a "standard" macro min, this macro enters two parameters and returns the smaller one, which mentions two topic points: knowing how to carefully enclose the arguments in parentheses in a macro is a side effect of a macro, such as what happens when you write the
1. As a macro function, you don't need to enclose character values in quotation marks as Step functions.One-on-which macro language is different from SAS language is macro-variable valuesbe always text, quotatio n marks is not needed to indicate TEXR constants in the macro language. EXAMPLEDsid=open ("sasuser.houses"
SolidWorks two times development -01-record a macro
First step:
We need to record a macro ourselves and then see what code the program produces. That's what I did when I was learning Excel. Just, SolidWorks to be more complex, directly recorded macros can not be used, need to make some adjustments. In the absence of experience we'd better follow the advice below.
Edit or Debug SolidWorks
C language Macro definition tips (common macro definitions)Write good C language, beautiful macro definition is important, using macro definition can prevent errors, improve portability, readability, convenience and so on. The following is a list of some mature software commonly used
First, preface
In C-language code or C + + code, macro definition #ifndef ... #define ... #endif主要是为了避免头文件重复引用, how is it a avoidance mechanism? This is related to the scope of the macro definition.
Two, macro definition scope
First, the scope of the macro definition in the C language standard is, starting at the defi
make the Parse_args more convenient to parse. Any text immediately following the "=" will be passed as input to FN.++++++++++++++++++++++++++++++++++++++++++++++++++++++++Continue to take __setup ("netdev=", Netdev_boot_setup) for example:To achieve netdev_boot_setup, which form does it appear in? :struct obs_kernel_param { constchar *str; int (*setup_func)(char *); int early;};This should be done in the form of:int netdev_boot_setup(char *str){ ... 0;}When the kernel starts pars
The class declaration does not have a Q_object macro.Class Cerror1:public Qobject{Signals:void onbutclicked ();};Class Cerror2:public Qobject{Signals:void onbutclicked ();};Class Cerror1:public Qobject{Q_objectSignals:void onbutclicked ();};The class declaration plus q_object is good.Class Cerror1:public Qobject{Q_objectSignals:void onbutclicked ();};Class Cerror2:public Qobject{Q_objectSignals:void onbutclicked ();};Class Cerror2:public Qobject{Q_objectSignals:void onbutclicked ();};Error:class
You can delete a blank paragraph in Word by using the following macro code.
Sub Delblank ()
Dim I as Paragraph, n as Long
application.screenupdating = False ' Turn off screen refresh
For all I in activedocument.paragraphs ' loops in the collection of paragraphs in the active document
If Len (i.range) = 1 Then ' to judge the length of a paragraph, this can be based on the actual document
I.range.delete ' make the necessary modifications to remove
;timestamp = now; ...else { ...; }In this way, the compiler will be in the process of compiling, the more likely the code followed by the face of the code, thereby reducing the performance of the instruction jump caused by the decline.另外内核2.6.31.5中likely和unlikely另一种定义:# ifndef likely# define likely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))# endif# ifndef unlikely# define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0))# endifFor example (ke
1.likely unlikely
Branch declarations for conditional selection statements, GCC builds an instruction for optimization, which can be optimized for conditional branching when a condition is often present, or if the condition is rarely present. The kernel encapsulates this instruction as a macro, such as likely () and unlikely (), which makes it easier to use.For example, the following is a conditional selection statement:if (foo) {/* .. */}If you want
"The function you are trying to run contains macros or content that needs to be supported by the macro language." When you install this software, you (or your administrator) choose not to install the support features of macros or controls. ”
No matter what button there will be several follow-up dialog box out, several times after the file finally opened. Come out again when you close the Document dialog box: "Changes affect the Normal.dot of the sh
This paper records a non-reference video quality evaluation algorithm. This is our own laboratory in the first two years of a sister-in-the-job, the algorithm is still relatively accurate, in this record.
Note the premise of this algorithm is high-definition video. And it's a coding method of H.
The method mainly uses the parameters of two code stream to evaluate the quality: Quantization factor (QP) and the number of skipped macro blocks (Skip_num)
1. Macro definitions can be divided into 2 types:Macro definition with no parametersMacro definition with Parameters2. DefinitionGeneral form#define Macro Name stringLike #define ABC 10.The string on the right can also be omitted, such as # define ABC3. RoleIt is used to define constants by replacing all "macro names" in the source program with the right "strings
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.