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
#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 macro definitions are self-exp
The difference between a macro and a function with parameters? Macro substitution does not take up a run time, only the compile time, and the function call takes up the elapsed time (allocation Unit, reservation field, value Pass, return), so each execution is loaded so it is slower to execute.? When defining a macro, do not type a space between the
People who are new to MFC programming are often intimidated by various macro definitions and preprocessing commands generated by the MFC wizard. However, preprocessing and macro definition are a powerful tool in C language. They can be used for simple source code control, version control, warning, or some special functions. A classic exampleThe most classic example of using preprocessing and
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
We all know that using macros is not only convenient, but also can improve development efficiency. Here's a summary of some of the common macros in the iOS development process that will continue to be added.
Objective-c
Whether the string is empty #define KSTRINGISEMPTY (str) ([str iskindofclass:[nsnull class]] | | |-str = NIL | | [STR length]
1. Define macro for Dimension class
DimensMacros.h
//status bar height
#define Status_bar_h
1. Recognizing
The variable length parameter is a special parameter form of the C language, such as the following function declaration:
int printf (const char *format, ...);
Such a declaration indicates that the printf function can append any number of arguments, any type of argument, except for the first argument type, which is a const char*.
The implementation of printf, for a rough example.
Assuming that Lastarg is the last named parameter of a variable-length parameter function (for example
Turn from: http://blog.csdn.net/norains/article/details/5935279
//=====================================================================TITLE:STM32F10X_XX macro-defined selectionAUTHOR:NorainsDATE:Tuesday 12-october-2010Environment:KEIL MDK 4.0Redcow Board//=====================================================================
If you use Stm32f10x_stdperiph_lib, you will find that there is a section of code in the Stm32f10x.h file about
Macro definitions often appear in the C + + code, in the form of "#define * * *". There are also "macro variables" in Java, but another form.
Final is a keyword in Java that is used to modify classes, member variables, local variables, and methods to represent immutable. When final modifies a variable, the variable is already specified as an initial value, and the variable is determined at compile time, th
in her platform can be compiled through. Her platform is VS2012, and my platform is VS2010. Is it really a platform problem? I googled it and found that the common solution was to add the following header file
#include
I tried and found no way, or there is red line below. Looking for a long time, finally found the max and Min macro definition of the header file "Stdlib.h." I opened this file and the relevant paragraphs are as follows
/* Minimum and
1. How do I distinguish "macro name" from "macro string" in macro definition "? What should I pay attention to for macros with parameters?
In macro definition, "macro name" and "macro string" are distinguished by "space. During
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
One of the advantages of preprocessing commands and macro definitions in VC
Author: Liu Wei Source: blog responsibility Editor: Ark
People who are new to MFC programming are often intimidated by various macro definitions and preprocessing commands generated by the MFC wizard. However, preprocessing and macro definition are a powerful tool in C languag
Process_thread_ hello_world_process }The statement in the back defines a process variable hello_world_process, and assigns the initial value, which is handled by strname to simplify.In summary, the processmacro definition, which has two functions, declares that the process executes an entity function and defines the processes structure body variable as follows:Static Char process_thread_hello_world_process(struct pt *process_pt, process_event_t ev, process_data_t data); st
", that is, "Macro", in Word, the use of macros can be a hot key to complete the multi-step operation, users can write their own scripts, but the macros in Word are limited to use in Word.
If you want to use a hotkey instead of a multi-step keyboard or mouse operation, we can use software such as the "Key Wizard" to implement, figure 1 is the "Key Wizard" interface.
screen.width*0.7) {this.resized=true this.width=screen.width*0.7; this.alt= ' Click
macros, such as a macro Ptrtype is also used to rename a type, which is implemented as follows: #define PTRTYPE (_t, _name) typedef _t _NAME; But the practical results are: Ptrtype (void (int), PTR)//compilation not passedPtrtype (void (*) (int), PTR)//compilation not passedPtrtype (int, Ptr)//This is possible.typedef void (*PTR) (int);Ptrtype (PTR, PTR)//this is possible. So is there a way to make the above macr
Original address: C + + library research notes--macro definition of function name
6.47 Function Names as strings:http://gcc.gnu.org/onlinedocs/gcc/function-names.html
GCC provides three magic variables that hold the name of the current function, as a string. The "A" is __func__, which are part of the C99 standard:
The identifier __func__ is implicitly declared by the translator as if, immediately following the opening brace of each Fu Nction definit
differences between inline functions and macro definitionsInline functions can speed up the program when compared to normal functions because no interrupt calls are required, and inline functions are embedded directly in the target code at compile time, and the macro is simply a replacement.Inline functions need to be checked for parameter types, which is the advantage of inline functions and
When you use a macro, enclose each parameter in parentheses and enclose the overall definition of the macro; In general, do not use the self-increment or decrement operator in a macro.
[1] Maximum value
#define MIN (x, Y) (((x)
Ask the lesser of the two
#define MAX (x, y) ((x) > (y))? (x): (y))
Ask the larger of the two
#define MAX3 (X,Y,Z) max (Max (x,y),
People who are new to MFC programming are often intimidated by various macro definitions and preprocessing commands generated by the MFC wizard. However, preprocessing and macro definition are a powerful tool in C language. They can be used for simple source code control, version control, warning, or some special functions.A classic exampleThe most classic example of using preprocessing and
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.