A Clang.

Clang is a lightweight compiler for C, C++, and Objective-C. Source code is published under the BSD protocol.

Clang will support its normal lambda expressions, simplified handling of return types, and better handling of constEXPr keywords.

Clang is an Apple-led, LLVM-based C/C++/Objective-C compiler.

Clang-rewrite-objc main.m -o main. CPP error compiling object file to c++ file UIKit

Clang-rewrite-objc-fobjc-arc-fobjc-runtime =ios-13.0.0 -isysroot / Applications/Xcode. App/Contents/Developer/Platforms/iPhoneSimulator platform/Developer/SDKs/iPhoneSimulator13.0. The SDK M xcode installs the xcrun command along with the main.m xcode. The xcrun command encapsulates clang, To better use some xcrun-sdk iphonesimulator clang-arch arm64-rewrite-objc main.m -o main-arm64.cpp (emulator) xcrun-sdk iphoneOS Clang-arch arm64-rewrite-objc main. m-o main-arm64.cpp (handset)

The nature of the object

You can view the source code of the object from Clang

For example, LGperson looks like this

Clang can see the underlying source code

You can see that the object is essentially a structure and the Class is essentially of type objC_class

We can also get the set and get methods of the object

To get the property value of an object, first know the first address of person, then shift the translation of ivar’s space, then get the address of the property, then get the property value.

Consortium bitfield Is used to save memory space, how to save?

For example, the structure is as follows:

4*8=32 bits =0000 0000 0000 0000 0000 0000 0000 1111

To save space, it can be expressed as follows:

So a byte can be identified

If we express it as follows:

Front is 1 bit, back is 2 bits, left is 6 bits, and right is 1 bit, because there is a mutual exclusion and the memory usage after the mark is 2 bytes.

Next we can see that member variables of the following structure can be assigned at the same time,

But in union weights, member variables cannot be assigned at the same time, but the memory of the remaining member variables is not available for dirty data.

All variables in a struct are “co-existing” — the advantage is “tolerant” and comprehensive; The disadvantage is that the allocation of struct memory space is extensive, regardless of use, full allocation.

In a union, the variables are mutually exclusive — the disadvantage is that they are not “inclusive” enough. Logic education, but the advantage is more precise and flexible memory use, but also save memory space.

Isa in four.

The bottom layer of the isa

Why isa_t? NonPointerIsa occurs during the representation of a class’s address, rather than a simple pointer. Class object is a pointer, and it would be wasteful to store a pointer in 64 bits, so we would put whether we are releasing, reference counts, weak, associated objects, destructors, and so on in this memory, hence nonPointerIsa. You can view it in a bit-domain.

Objects get class information through isa masks

View by panning: