IOS block programming guide 1 Introduction, ios programming guide

Source: Internet
Author: User

IOS block programming guide 1 Introduction, ios programming guide
Introduction (Introduction)

Block objects are a C-level syntactic and runtime feature. they are similar to standard C functions, but in addition to executable code they may also contain variable bindings to automatic IC (stack) or managed (heap) memory. A block can therefore maintain a set of state (data) that it can use to impact behavior when executed.

A block object is a C-language syntax and runtime feature. They are similar to Standard C functions, but apart from executable code, they can also contain stack (stack, memory automatically managed by the system) or heap (heap, manual Memory Management) memory variable. A block can save a State (data) setting. Therefore, when executed, the block can use these settings to affect behavior.

You can use blocks to compose function expressions that can be passed to API, optionally stored, and used by multiple threads. blocks are special useful as a callback because the block carries both the code to be executed on callback and the data needed during that execution.

You can use block to combine function expressions to pass them to the API, store them at will, and use them by multiple threads. Block is often used as a callback function because the block also has the code for executing the callback and the required data.

Blocks are available in GCC and Clang as shipped with the OS X v10.6 Xcode developer tools. you can use blocks with OS X v10.6 and later, and iOS 4.0 and later. the blocks runtime is open source and can be found in LLVM's compiler-rt subproject repository. blocks have also been presented to the C standards working group as N1370: Apple's Extensions to C. as Objective-C and C ++ are both derived from C, blocks are designed to work with all three ages (as well as Objective-C ++ ). the syntax reflects this goal.

The gcc and clang of the Xcode developer tool in OS X 10.6 allow block. You can use block in OS X v10.6, IOS 4.0, and later versions. The block Runtime is open-source and can be found in LLVM's compiler-rt subproject repository. Block is also presented in standard C. See N1370: Apple's Extensions to C. Because both objective-C and C ++ come from C, the block is designed to run in these three languages (or in Objective-C ++ ). Block syntax to achieve this goal.

You shoshould read this document to learn what block objects are and how you can use them from C, C ++, or Objective-C.

You should read this document to learn what the block object is and how to use the block in C, C ++, and objective-c.

Organization of This Document (Organization of the block Document)

This document contains the following chapters:

  • Getting Started with Blocks provides a quick, practical, introduction to blocks.

  • Conceptual Overview provides a conceptual introduction to blocks.

  • Declaring and Creating Blocks shows you how to declare block variables and how to implement blocks.

  • Blocks and Variables describes the interaction between blocks and variables, and defines__blockStorage type modifier.

  • Using Blocks illustrates various usage patterns.

This document includes the following chapters:
  • Getting Started with Blocks provides a quick and practical introduction to block
  • Conceptual Overview provides a Conceptual block Introduction
  • Declaring and Creating Blocks tells you how to define and implement Blocks.
  • Blocks and Variables introduces the internal relationship between Blocks and Variables, and defines _ block storage type modification.
  • Using Blocks introduces different block usage modes
This article is original, reproduced please indicate the source: http://blog.csdn.net/zhenggaoxing/article/details/44302505

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.