C ++ content (for personal use

C ++ source file into an executable file from the process

This is another blog detailed procedure
1. pretreatment 2. 3. Assembler 4. Compile Link
contents compiled object files produced: there are at least two sections - the code and data segments
disadvantages links in dynamic / static linked

In C ++ handles (the feeling of little use)

Relations and differences between C ++ and Java

Global and static variables are initialized at what time?

An error occurred while / Link run / compile

Talk about the difference between C ++ and C

Design thought:
C ++ object-oriented language, and C is the process-oriented programming language structures
(for Process - Step of
process-oriented step is implemented to analyze the needs required, further steps to achieve these functions by one step, and then successively you can call the
object-oriented - the behavior of the
object-oriented demand is whole in accordance with the characteristics of functional division, the presence of these common elements packaged as an object, the object is not created in order to complete certain steps, but describes some things in problem solving step behavior)
syntax:
C ++ with encapsulation, inheritance and polymorphism three characteristics
C ++ compared to C, increases many more type safety features, such as casts, C ++ supports the paradigm programming, such as a template class, function templates

C ++, const (something magical)

This is the C ++ constant folding: means const variable (i.e., constant) values ​​in the compiler's symbol table, the compiler calculating values ​​directly from the table, eliminating the memory access time, so as to achieve optimization.

And on this basis, coupled with volatile modifier that tells the compiler that the variable part of fickle, do not optimize this sentence, go fetch the amount of memory each time the calculation. ( However, some compilers will not bother volatile ) if not volatile, it may take const constants obtained from the register or symbol table.

The difference between C / C ++ pointers and references

1. a pointer has its own space, and reference is just an alias ;
2. See sizeof size of a pointer is 4, and the reference is the size of the referenced object;
3. pointer can be initialized to NULL, and reference must be must be initialized and an existing object reference;
4. passed as a parameter, a pointer to be dereferenced can operate on an object, a reference to direct changes will change the reference object points;
5. const pointer can , but there is no reference const;
6. in use, the pointer can point to other objects, but only a reference is a reference to an object can not be changed;
7. pointer can have multiple level indicators (** p), while only one reference ;
8. sense ++ pointers and references are not the same operator;
9. If the object returns dynamic memory allocation or memory, the pointer must be used, reference may cause memory leakage.
PS. Pointers and references to the time of compilation layer, command execution can be said to be the same

Common new features of C ++ 11 (very good!)

C ++ 11 STL in four smart pointer

ps: smart pointer in memory is clear destructor
since the smart pointer class nature, so smart pointer memory is released by the destructor!
unique_ptr instead of auto_ptr, because the former - two unique_ptr can not point to an object that is not unique_ptr shared objects it manages. It can only achieve the transfer of resource management authority. This means that memory resource ownership can be transferred to another unique_ptr, and the original unique_ptr no longer have this resource.

C ++ 17 new features

The C ++ 17 inline variable

A note: once C ++, multiple file references the same header files, if you want to use a common variable shall use the extern keyword in the header file, you can now use the inline
here is extern usage

Linking the C ++ function

C ++ four kinds of cast

Advantage of red-black tree (non-C ++)

C ++ STL in allocater

STL nature of this thing comes to memory usage

The underlying principle of the C ++ STL container

In C ++ using the STL iterators remove elements

Associated container and the container has a different sequence case, the list, it is not continuous use of the memory allocation, and its erase method also returns the next valid Iterator, so the above two kinds of the correct way may be used.

STL in the reserve C ++ () and risize ()

C ++, the difference between struct and class

C ++ virtual functions Implementation Mechanism

And by the virtual function pointer vtpr vtbl vtable

Pure virtual functions in C ++

C ++ virtual inheritance single inheritance multiple inheritance

The difference between heap and stack memory partition and C ++

C ++ How to detect memory leaks

C ++ Volatile keyword analysis

Deep into the compilation of the register and the level of understanding of the language, because the debug version and release version is not the same level assembler language testing standards, it leads to the next question

The difference between debug version and release version

Copy constructor, shallow vs. deep copy
Details templates

Choose a template and virtual functions

Personal understanding:
virtual functions for more diversity is a functional, a method of operating realized (made in pasta and steamed buns made of fried noodles make a difference, but the practice is totally different from the same main ingredient)
template is more for the same operation diversity implemented in different types (in distinction skewer kebabs and pork strings, but a different approach is identical Ingredients)

The principle of the new and delete

C ++ and Java differences and relations

override (rewrite) and final (final) two keywords

Interestingly address the substance of the variables +1

Released nine original articles · won praise 1 · views 154

Guess you like

Origin blog.csdn.net/qq_37782336/article/details/104533032