#, # @ And \ symbols in the macro definition of C LanguageSource: Liu shihui Rubby logs
1. # (stringizing) string Operators
Purpose: Convert the input parameter name in the macro definition to a parameter name string enclosed by a pair of double quotation marks. It can only be used in macro definitions with input parameters, and must be placed before the paramet
Macro _ va_args _ of variable parameters in C Language __
1 .#
If you want to include macro parameters in a string, ansi c can do this. In the macro replacement section of the class function,
# The symbol is used as a preprocessing operator to convert the language symbol into a string.
For example, if X is a macro pa
1. Add a trace statement to MFC
2. In tools> MFC tracer, select enable tracing and click OK.
3. debug and run go (F5) (Note: not execute '! 'The reason why we couldn't see trace content in the past is that it wasn't debugging, '! ', Remember, remember)
4. The trace content will be displayed in the debug window in the output. The debug execution will automatically jump from the build window to the debug window, where the trace content will be displayed, ^_^
The following is a detailed description
工欲善其事, its prerequisite.Before you formally implement all the cool features and UI, getting ready is the only way to improve the efficiency of your next development.So, this series, I am not in a variety of heap technology, more attention is "Bing" before the "grain line", some cumbersome, but when the whole context is clear, the follow-up work is only on the good Foundation and framework of unlimited expansion and optimization.Macro definition is an effective tool for improving efficiency in th
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)
If you are a C programmer, you must be familiar with macros, they are very powerful, if used correctly can make your work more effective. Then, if you're defining macros and you're not checking them out at random, then they can make you mad and waste n more time. In many C programs, you may see a number of more specific macro definitions that seem less straightforward. Here's an example:1 #define _set_taks_state (tsk, State_value) 2do {ts
MFC Technical Instructions:
In MFCSDK switch method to process Windows messages,
By message ing table(Message map) and virtual function polymorphism to process the specified form message
1. Declare a message ing table(Message map) Add a macro to the class that can process messages
Declare_message_map () Note:
MFC has a more detailed system overview. Here we only introduce several macro definitions.
Okay, I studied the underlying implementation principle of switch () last night. I found that it is not as mentioned in C language textbooks. Of course, this is for those who are very familiar with assembly, is a piece of cake. In the world, many things are a combination of coincidence and necessity. There is no love for no reason or hate for no reason.-Why am I blocked by a switch? What is the important role of this switch in contiki? Without answering this question, let's take a look at how to
There are two steps: Expand the macro first, and then evaluate the value.
Because there is a macro definition (macro body here) that cannot be evaluated during compilation, the macro parameter is not yet available. Macro parameters must be known only when the compiler sees t
int ys=2012;
if (Is_leap_year (YS))
//Usually the preprocessor is defined on a line if a good branch, for example, is too long to be wrapped, you need to use the symbol "/" to indicate that there is another line, multirow, for example:
#Define Is_ Leap_year year%4==0year%100!=0/
| | Year%400==0
//macro definition parameter put a # then when you call the macro, the preproc
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
A macro definition can contain two operators: # And ##.
# The operator converts a macro parameter to a string literal. It can only appear in the replacement list of macros with parameters. # Operators have a lot of usage. Here we will only discuss one of them.
Suppose we decided to use the PRINT_INT macro as a convenient method during the debugging process to ou
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 correspondin
These two days a little bit of boost preprocessor library, found that the boost of the crazy people to use a variety of artifice to define a variety of data types and structure, but also in the above definition of subtraction and so on various operations, in the process of rapid browsing, but also targeted the very familiar with the various macro names: list,Cons,fold_left, Fold_right, estimates that these people have moved a lot of the features of fu
Raise questions:
Zabbix monitors the file system through LLD. zabbix first discovers all file system names and types through discovery rule, as shown below:
shell#zabbix_get-s127.0.0.1-kvfs.fs.discovery{"data":[{"{#FSNAME}":"/","{#FSTYPE}":"rootfs"},{"{#FSNAME}":"/proc","{#FSTYPE}":"proc"},{"{#FSNAME}":"/sys","{#FSTYPE}":"sysfs"},{"{#FSNAME}":"/dev","{#FSTYPE}":"devtmpfs"},{"{#FSNAME}":"/dev/pts","{#FSTYPE}":"devpts"},{"{#FSNAME}":"/dev/shm","{#FSTYPE}":"tmpfs"},{"{#FSNAME}":"/","{#FSTYPE}":"ext
This article comes from http://blog.ednchina.com/wangxing/160233/message.aspx
Write a good C language. A beautiful macro definition is very important. Using a macro definition can prevent errors, improve portability, readability, and convenience. The following lists some mature software commonly used macro definitions ......
1. prevent a header file from being re
, the advantage of this method is that you can print the expression content in a unified way. Similarly, the following macro can be defined to print the values of other expressions:
# Define printc (expr) printf ("
# Define printf (expr) printf ("
# Define printd (expr) printf ("
In the GCC compiler, two string constants can be connected to a new string. Strings are equivalent as follows:
"123456" and "123" 456"
Because # expr is essentially a string,
1 .# If you want to include a macro parameter in a string, ansi c can do this. In the macro replacement section of the class function, # use the symbol as a prefix. Processing Operator, which can convert the language symbol into a string. For example If X is a macro parameter, # X can convert the parameter name into a corresponding string. This process is call
In C ++ programming, functions (including inline functions) are generally in lower case, while macro-defined "functions" (macros with parameters) are often in upper case.
The above sentence seems common, but failing to follow this sentence can easily lead to unexpected errors! Today, we will record a typical case:
Because inline functions are very similar to macros, they are performed before the program runs. They both replace expressions with the fun
In C + + development often used in the definition of macro use "#" or "# #", the following is a simple description of the use of two symbols:Define in the # is to use the argument after the # as a symbol, simply to connect it as a string, # #连接前后2个符号, the define definition in the beginning of the "#" macro substitution is not expanded, the macro beginning with th
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.