I,
1. byte sequence: on a specific hardware platform, there are two ways to store multi-byte data in sequence (little-Endian and big-Endian ). Low bytes of the former data
Some are stored in Low-address memory, and the latter is the opposite. PC is generally based on IA-32 microprocessor, belonging to little-Endian. Some CPU resources in the CPU architecture, such,
Such as PowerPC, which belongs to big-Endian.
2. Call functions, stacks, visible scope of variables, and life cycle: we know that a program consists of two parts: Data and Code. There are several types of data, one of which is "static, that's it.
It means that the address in the memory is fixed during the entire program running, and the code can be accessed repeatedly. The external variables in C language, internal static variables belong to this class, store
Data Segment (the data address can be accurately calculated when the program links ). The other is "dynamic". Their memory address is not fixed and their operations
Is to operate on the stack.
3. Declaration and definition of variables: "Declaration" only tells the compiler that a certain identifier is: variable (what type ?) Or a function (What are parameters and return values ?). If
This identifier appears in the code, and the compiler will know how to handle it. Declaring a variable does not cause the compiler to allocate storage space for the variable.
4. Compilation and link: one of the tasks to compile a program is to record all the symbols of the addresses to be determined, and then the linking program will be computed after finding their definition points.
A suitable address. When all symbols have a fixed address, the linked program can generate executable files. If there are symbols, the address cannot be determined (the definition cannot be found or the definition is repeated)
The link program reports an error.
5. Link Properties of external variables and static internal variables: the default Link Properties of external variables are external (extern), static changes the link nature of external variables, so that external variables
The link is internal. For internal variables, static changes the storage nature, so that the visible range remains unchanged. The lifetime is during the program running.
6. function declaration, definition, and link nature:
7. Use the header file: the header file should contain the function prototype declaration, global variable declaration, and custom macros and types;
Should not include: global variables and function definitions (global variables can only be defined once, if you put the statement "int global = 0;" in the header file)
The global variable is defined wherever this header file is included. When the link is reached, the link program will report that many songs are found in global.
I don't know which one to use. This is also the case of a function. A name conflict also occurs, leading to a link failure.
Static variables and static functions (between the definition of a global variable declaration and a static variable, static takes precedence, so
The code for global variables, but the last accessed is a static variable defined by the header file, useless ).
II,
8. Static Library: the structure of the static library is relatively simple, that is, to put the original target code together. When linking, the link program searches for the corresponding Symbols Based on the symbol table of each target code.
(Name of the function and variable), locate the symbols to be located in the function, and then put the entire function code into the executable file.
9. Dynamic library: when a program is loaded into the memory, the library function code is actually linked to determine their addresses. Even if multiple programs are running
Only one copy of function code exists. However, the data in the dynamic library may still have multiple copies. Because every process linked to a dynamic database may modify the database data.
The operating system copies a copy of the data, and then modifies the address space ing of the process so that it points to the new data copy.
Copy data.
10. Simple conversions: conversions between integers (if the extended variable is signed, the extension is signed extension; if the extended variable is not signed
Extension is an extension without symbols ). It is not necessarily safe to convert integer values to floating-point values. Although the floating-point value range is large, it is limited by precision (up to 6 digits
Valid number ).
11. Composite Type alignment
12. pointer: pointer array, function pointer (store the address of the called function, pointing to the function ),
Pointer and array: the pointer and array name both represent the address of a variable. The difference is that the pointer is a variable, and the compiler will allocate storage space for the pointer, and
The pointer value can be changed at will during runtime.
The array name only represents the starting address of a bucket. The array name is equivalent to a constant, and the compiler does not allocate space for the array name itself,
The array name cannot be changed.
Array pointer, pointer to pointer, multi-dimensional array
3.
13. lexical analysis: Maximum Matching Principle
14. Note:/**/and //
15. Priority and operation sequence: Do not make too many assumptions about the operation sequence.
16. Friendly typedef: defines a new data type name and actually assigns it an alias.
Typedef has a visible range like a variable, and the inner layer can overwrite the outer layer.
Different data types cannot be defined using the same name within the same range.
# Define (pre-compiled command) Only executes low-level symbol replacement. typedef is used by the compiler for syntax analysis and its defined type pairs.
Each variable in a declaration or definition statement takes effect.
17. c_v qualifier: const is different between C ++ and C.
1) C ++ can regard the const variable (assigned by an existing constant) as a constant in the compilation period. C does not have this function.
2) by default, C ++ uses the const variable to link internally, while C uses the default const variable to link externally.
3) C can only use constants to initialize const external variables. c ++ does not have this restriction.
Volatile modifies a variable to tell the compiler that the variable may be modified by an external event. during compilation, do not impersonate the variable during code optimization.
.
18. String: A String constant, which cannot be changed. The pointer to a string cannot be modified.
You can use string constants to initialize character arrays and modify the values of character arrays.
19. Void: The Void pointer has two main features:
1) The Void pointer can be converted to other types of pointers (except function pointers) without forced type conversion.
2) You cannot perform value and subscript operations on it.
In C ++, the type check is very strict. Any pointer (including the void pointer) can be directly assigned to other pointers without force conversion;
However, in C ++, if the value of other types of pointers is assigned to the void pointer, no forced conversion is required, which is consistent with that of C. (If the void pointer is assigned to another pointer, it must be forcibly transferred.
Change)
20. # pragma provides specific compilation instructions for specific compilers. _ Pragma
21. _ complex and _ imaginary
22. inline function: a macro is just a replacement of a mark. Unlike a function, it cannot know what the real parameter is, so it cannot check the parameter or be like
The function limits some operations to internal ones.
Since inline functions require the compiler to embed the function code at the call point as much as possible, only one inline function is declared, but the function is not provided in the same file.
The defined practice is meaningless. C ++ makes it clear that once a function is declared using inline, this function becomes an inline function, and all
The file should provide function definitions, and all these definitions should be the same. Therefore, the definitions of inline functions are generally placed directly in the header file.
The Inline modifier of C ++ does not change the link feature of the function, so the inline function can have the external link feature. Further provisions, so external links are inline
All functions must have the same address. Static variables defined inside them all point to the same object.