0. PrefaceFrom the beginning of learning C language began to contact Makefile, consulted a lot of makefile information but the total feeling did not really master makefile. Assuming that you write a makefile, you always think it's very exhausting.So deliberately using the blog to summarize the relevant knowledge of makefile. The detailed use of the makefile is illustrated by the sample example.Examples say that makefile is divided into the following sections. For a lot of other content please re
When we use word2010 to do a very repetitive work, we can record it as a macro to use, both convenient and efficient. Today, the small script for everyone to bring WORD2010 record macro operation process, the need for friends can take a look at learning! Introduction to the ingenious use of Word2010 document content controls
Word is a great Office software for word processing, although many other word prod
In the process of writing code, often output some debugging information to the screen, will normally call printf this kind of function.But when debugging is done, we need to manually remove or annotate these places.Recently watching the "Linux C programming One-stop learning" This book, I think of a method:
Copy Code code as follows:
void myprintf (char* fmt, ...)
{
}
#ifdef DEBUG
#define printf (fmt, args ...) myprintf (FMT, # #args)
#endif
Debug phase with Debug
);printf ("%d%d/n", I, j);Return}We can declare our functions in our header file in this way:extern void Simple_va_fun (int i, ...);We can call this in the program:Simple_va_fun (100);Simple_va_fun (100,200);As you can see from the implementation of this function, we should have the following steps with variable parameters:1 first in the function to define a va_list type of variable, here is arg_ptr, this variableQuantity is a pointer to a parameter.2) and then using the Va_start
access| Program | A control macro refers to a collection of one or more actions, each of which implements a specific function, such as opening a form or printing a report. Macros enable certain common tasks to be completed automatically. For example, you can set up a macro that runs the macro when the user clicks a command button to open a form.
A
MacroAn understanding of macros (macro):Think of it as a function in JINJA2 that returns a template or HTML stringTo avoid writing the same template code over and over again, there is code redundancy that can be written as a function for reuse.Template code fragments that need to be reused in multiple places can be written to separate files and then included in all templates to avoid duplicationDefining macros{% m
directory of this document
Introduction to preprocessing Directives
One, macro definition without parameters
Second, macro definition with parameters
Description: This C language topic is the prelude to learning iOS development. And for programmers with an object-oriented language development experience, you can quickly get started with C language. If you don't have programming experie
Introduction to preprocessing Directives
One, macro definition without parameters
Second, macro definition with parameters
Description: This C language topic is the prelude to learning iOS development. And for programmers with an object-oriented language development experience, you can quickly get started with C language. If you don't have programming experience, or are no
During program debugging, we often need to output some debugging information. After the debugging is completed, we no longer need to use it. So how can I quickly switch between the debugging and publishing statuses? We usually use pre-compilation and macro definition to solve this problem, for example:
# Ifdef debug
Debug code
# Endif
If we use printf to display some debugging information, it is very troublesome to add # ifdef and # endif in every pla
From: http://timyang.net/
Most engineers, including architects, started from the micro-architecture. Micro-architecture refers to the rationality of design and implementation in a local field, for example, the rationality of writing a sort program to achieve the complexity of time space, at the same time, it has reached a reasonable standard in terms of code readability, scalability and maintainability. However, in a system, there are not only micro-problems. The
A classic example
The most classic example of using preprocessing and macro definition is to add a header file to avoid the header file being compiled twice. In this case, there is a file headerfile. h. It is included in headerfile1.h and also included in headerfile2.h. Now there is a CPP file, implement. CPP contains headerfile1.h and headerfile2.h:
# Include "headerfile1.h"# Include "headerfile2.h"
Assume that headerfile. h defines a
Parameters of the output functions printf () and fprintf () are variable. When debugging a program, you may want to define your own variable output functions,
The Variable Parameter macro is an option.
The macro in c99 can have variable parameters like a function, such
#define LOG(format, ...) fprintf(stdout, format, __VA_ARGS__)
Where,... indicates that the parameter is variable, __va_args _ is replaced
Preface:
When writing a program, we always add some printf and other statements to output debugging information, however, the most inconvenient part of the printf statement is that when we need to release a program, we need to delete these statements one by one. Once we need to debug the program again, these statements have to be added one by one, which makes us very inconvenient, wastes a lot of time, and causes low debugging efficiency. Therefore, many may choose to use
Part 1: Macro Why use Macros? Because function calls mustProgramThe execution sequence is transferred to an address stored in the memory of the function. After the program content of the function is executed, it is returned to the place before the function is executed. This transfer operation requires that the on-site address should be stored and remembered before the transfer is executed. After the transfer, the on-site address should be restored an
Recently see the C language project in the macro definition used Do...while (0), feel is a knowledge point, special to summarize.First look at this sentence:do{...} while (0) is the only constructor in C that allows you to define a macro that always works the same way, so that no matter how the macro is used (especially if the statement that calls the
Zabbix topic: Eighth Ohata: MACROInterested in Linux friends join QQ Group: 476794643 Online communicationThis article anti-theft chain: http://zhang789.blog.51cto.comZABBIX macro
(1) The macro is an abstraction, He replaces certain text patterns based on a set of predefined rules, and the interpreter or compiler automatically makes this pattern substitution when it encounters a
*************************************************************************************************************** **************Easywave Time: 2015.02.20Category: Linux application-GCC compiler's internal pre-macro definition and __attribute__ attribute declaration: Reprint, please keep the linkNote: If there is an error, please correct me. These are the journal articles I studied ...**********************************************************************
In the standard library of C, the input and output functions of the standard libraries of printf, scanf, sscanf, sprintf, sscanf, parameters are variable. When debugging a program, we may want to define a variable output function to record the log, so a macro with variable parameters is a good choice.In C99 , a macro can also be defined as a function with variable parameters, such as:#define LOG (format, ..
Description $ (RemoteMachine) Set to the value of the remote computer property on the Debug property page. For more information, see Changing the project settings for A/C + + Debug configuration. $ (References) A semicolon-delimited list of references is added to the project. $ (ConfigurationName) The name of the current project configuration (for example, "Debug"). $ (PlatformName) The name of the current project platform (for example, "Win32"). $ (Inherit) Specifies the order in which inherite
Description$ (RemoteMachine)Set to the value of the remote computer property on the Debug property page. For more information, see Changing the project settings for A/C + + Debug configuration.$ (References)A semicolon-delimited list of references is added to the project.$ (ConfigurationName)The name of the current project configuration (for example, "Debug").$ (PlatformName)The name of the current project platform (for example, "Win32").$ (Inherit)Specifies the order in which inherited properti
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.