C + + Related: Not very understanding of C + +, although learned, but not very good, use is very little.
1.inline function
The basic form:
int min (intint second)
The keyword inline is to be associated with the definition of a function in order to be an inline function:
The difference between the declaration and definition of a function:
inline void Foo (int x);
void Foo (int x) { ...}
Inline is the "keyword for implementation", not the keyword used to generate it. The declaration is equivalent to an external interface, and the caller does not need to know whether it is an inline implementation.
member functions that are defined in a class automatically become inline functions.
class a{ public: void Foo (intint y)// Automatically become an inline function { ... }};
If the code in the inline function is too long or has a loop, it is not recommended to use an inline function.
Keywords that use inline functions are not necessarily expanded in the compiler, and the compiler is selective.
The header file contains the definition of the inline function, not the declaration.
You cannot define a function with the same name in a different source file but implement a different inline function, a conflict occurs.
The inline function mechanism has the efficiency of macro code, increases security, and is free to manipulate data members in the class.
Mechanism of macro code: The #define itself is not a function, but it is used like a function. The compiler preprocessor replaces the function call by copying the macro code, eliminating the argument stack, call invocation, return parameter, and return process, which increases the speed. But error-prone, there is a marginal effect when copying macro code. It is not possible to debug. Cannot manipulate private data members. Except for the assert, used for macro definitions, not functions.
Inline functions can be debugged: there is no real inline in the debug version, and like normal functions, the release version is actually inline.
Data:
1. Some concepts of problem-making are unclear
2 binary of n bits:
2^ (n1) * (AN) +2^ (n2) *an-1+ ..... 2^ (0) * (A0)
Problem:
Assuming that the following equation is true in N-binary, the N value is ()2880 : (2* (n^2) +4* ( n^1) +0*1) * (1* (n^1) +2* (n^0)) =2 * (n^3) +8* (n^2) +8* (n^1) +0 equation constant Set, So the result is an arbitrary binary
2. Linear table
A circular linked list is another form of chained storage structure. Changes the last pointer field in a list from null to the start node.
A queue is a chain structure that is only allowed to be removed at one end by inserting the other.
The stack is a chain structure that is inserted at the top of the stack and deleted.
An associative array is an array that has a special indexed way. You can index it not only by integer, but also by using a string or other type of value (except null). is not a linear table.
Size of 3.struct type:
In a 64-bit processor: The pointer is 8 bytes, int is 4 bytes, char is 1 bytes, total 13 bytes, but the struct must be an integer multiple of 8, so 16 bytes.
4.iterator.erase () method
is to delete the current character, and the pointer points to the next character.
#include <iostream>#include<vector>using namespacestd;intMainvoid) {vector<int>Array; Array.push_back ( -); Array.push_back ( -); Array.push_back ( -); Array.push_back ( -); Array.push_back ( -); Array.push_back ( -); Vector<int>:: Iterator itor; for(Itor=array.begin (); Itor!=array.end (); itor++) { if(*itor== -) {Itor=array.erase (itor); } } for(Itor=array.begin (); Itor!=array.end (); itor++) {cout<<*itor<<""; } return 0;}
The answer is:
- - - -
5.
C Error Reason: Class constants are not modifiable.
The characteristics of static members can be borrowed from another blog: http://www.cnblogs.com/morewindows/archive/2011/08/26/2154198.html Thank you.
Linux:
Linux is not known at all.
1.linux multiplexed I/O interface Select and epoll for high concurrency
Difference: Select polling mode, low efficiency, epoll is triggered, high efficiency
The number of sockets in the 1:select is limited, and the decision by Fd_setsize is generally 1024. by traversing a fd_setsize1024 socket, you decide which socket to schedule, regardless of whether it is active or not.
2.epoll Unrestricted, is the trigger, when there is a socket active state when the callback, if all the active state is back to the traversal mode.
Resolution of the number of sockets limit issue:
1. Modify the macros defined by Fd_setsize and recompile into the kernel, but this will result in a decrease in network quality.
2. Achieve multi-process.
Epoll no IO efficiency does not decrease linearly with the increase of FD number
Select will
The Epoll scenario is a large number of sockets, but more active is not very high. Epoll implements the data interaction between the kernel and the user through shared storage.
Ali Pen question 2017 key