# include "stdafx. H " # include // int FUNA (Int & refint) // call back function // { // STD: cout // return 0; //} // typedef int (* callback) (Int & ref ); // define callback as the function pointer /// int (* pfun) (Int & ref ); // pfun
1:Correctness, simplicity, and clarity come first
2:Make interfaces easy to use correctly and hard to use incorrectly
3:POne entity one cohesive responsibility
4:Const-correctness 5:Avoid macros 6:Make Header files self-sufficient 7:
# Called pound in English
In the macro definition of C language, one # represents stringized; two # represents concatenate
In macro definition, # is used to stringfication the macro parameters after it, that is, whether the macro variables are
Another use of this keyword is to use a technology called constructor chain to design classes. This design pattern is useful when multiple constructors are defined. Since constructor usually verifies input parameters to force various business rules,
Problem
Read the code of a database syntax parser the other day. In the lexical analysis Syntax Parsing stage, a struct is used to store the types of parsed SQL statements, according to this type, the modified struct is forcibly converted to another
Q: What exactly does const in C language and C ++ indicate? How is the specific implementation mechanism implemented? This article will analyze the two issues and briefly explain the meaning and Implementation Mechanism of Const.
Problem Analysis
To
Embedded C ++-Efficiency Analysis on C ++
Top embedded (TOP-E) | embedded Linux Enterprise Training | embedded Linux Employment Training | undertake embedded project development 17:14:37 Author: Top embedded open source: original text
1. Order of C ++ function parameters in the stack-from right to left
The following example is used to verify the order of C ++ function parameters in the stack:
Void test (INT I1, int I2, int I3)
{
Printf ("I1 = % d, I2 = % d, I3 = % d/N", i1, I2
An interesting phenomenon, excerpted from the original article "C ++ from scratch (12)-What is object-oriented programming ideology" on the cloud blog of csdn: http://blog.csdn.net/chuiyun/archive/2004/11/26/194722.aspx.
The reason why this article
Reverse C ++
Over the years, reverse engineering analysts have been using the Assembly and C knowledge to reverse engineer most of the software. However, nowadays, as more and more applications and malware turn to C ++ for development, it is more
Sequence point is interpreted in the C standard but obscure.
The sequence points laid down in the standard are the following:
The point of calling a function, after evaluating its arguments.
The end of the first operand of&&Operator.
The end
1. Insert sorting:
Algorithm Description
Generally,Insert sortAll are implemented on the array using in-place. The specific algorithm is described as follows:
Starting from the first element, this element can be considered to have been sorted
Sharpen the knife without mistakeThe old saying "don't cut firewood by mistake" is not suitable for C ++. If C ++ is compared to a knife, it will be a knife with excellent materials and shapes-just without a front. So we need to "Sharpen the knife ".
Q: Is a parent class having written a virtual function? Can a sub-class overwrite its function without the virtual function realize polymorphism?
A:Virtual modifiers are implicitly inherited. Virtual can be added or not added. The subclass space
String operations are a big topic in the Standard
C ++Medium,
StringThe character string class becomes a standard. The reason why char * strings are discarded
C ++In the standard library
StringClass, because it is compared with the former, do not
Program 1
# Include "stdio. H"# Include "conio. H"
Void quick_sort (int * a, int left, int right );
Main (){Int I, j, temp;Int A [10] = {30, 50, 40, 10, 60, 70, 80, 20, 27,11 };For (I = 0; I Printf ("% d", a [I]);Printf ("/N ");
Quick_sort (A, 0, 9 )
Sometimes we only need to allow one instance of the application to run. When the process starts, if an instance of the application is found to be running, it will automatically stop running. We usually use mutex in the main function. The general
C and C ++ languages have always been put together for example: C/C ++. As a result, Linus started to play C ++ with each other, and the users of these two languages began to intercept each other. I did not use C ++, but I was very happy to see it.
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service