1th: Understanding the origins of Objective-c language

Source: Internet
Author: User

1, OC language is evolved from Smalltalk. The language uses message structure rather than function call.

In the language of the message structure , the code executed by the runtime is determined by the operating environment;

The compiler does not need to be concerned about what type of object is receiving the message, but only at run time to find the method to be executed, which is also called dynamic binding .

The language used by the " function call " is determined by the compiler.

2. The OC object is allocated in the heap , and the OC object cannot be allocated in the stack (stack) .

The memory allocated in the heap must be managed directly, and the memory allocated on the stack to hold the variable is automatically cleaned up when its stack frame pops up. (That is, heap memory is managed by programmers (using the " reference counting " mechanism), and stack memory is automatically managed by the system. )

3, creating objects is more expensive than creating structs, so if you only need to save "non-object types" such as int, float, double, char, and so on, you can usually use structs.

  The structure is allocated in the stack.

1th: Understanding the origins of Objective-c language

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.