Discussion on the Data Language of C ++ Object Models

xiaoxiao2021-03-06  45

Binds of Data Member

An inline function entity that is not evaluated before the entire Class declaration is not fully seen. However, this is not true for the MEMBER FUNCTION ARGUMENT LIST. The name in the Argument List is still completed appropriately when they first encounter. Therefore, the non-intuition binding operation between Extern and Nested Type Names will still happen.

Data MEMBER's layout

MEMBER's arrangement requires only "Athly MEMBERS, which appears in Class Object" has a higher address "

Data MEMBER access

1. Static Data Member: It is only a unique entity in the program that belongs to a Class. When a Static Data Member address is obtained, a pointer to its data type is obtained instead of a pointer to its Class Member because Static Member does not contain it in a class member. In order to cause conflicts when Data Segment, the compiler's solution seems to be secretly encoded to each Static Data Mangling to get a unique program code.

2. NonStatic Dada Members: Points to Data Member, whose OFFSET value is always plus 1, which can distinguish between compilation system "a pointer pointing to Data Member to indicate the first Member" and "one" of Class. Pointer to the Data Member, no two cases of any member ". Each NonseTatic Data MEMBER is known for the compilation period, or even if Member belongs to a base class subobiect. Therefore, accessing a NonStatic Data Member, the efficiency and the MEMBER that accesss a C Struct Member or a Nonderived Class is the same. There is only a significant difference when there is a Virtual base class in the inheritance structure, and the MEMBER that is accessed is a major difference when MEMBER inherited from the Virtual Base Class.

3. "Inherited" on the impact of Data Member layout: C language guarantees "Base Class Subobject in Derived Class has its complete protozo". Otherwise, when the BASE CLASS replication is generated, Derived Class will be broken.

4. "Polymorphism" impact on the Data Member layout: Multi-state brings an additional burden of space and access time: Virtual Table, VPTR, enhances Constructor (set the initial value of VPTR) to enhance Destructor (erase VPTR). VPTR is typically placed at the front or rear end of the Class.

5. Effects of multiple inheritance Data Member layout: Multiple base classes is generally arranged in order, then Derived Class themselves.

转载请注明原文地址:https://www.9cbs.com/read-80030.html

New Post(0)