(译)IOS block编程指南 1 介绍

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 (stack) or managed (heap) memory. A block can therefore maintain a set of state (data) that it can use to impact behavior when executed.

block 对象是一个C语言级别的语法和运行时特征。他们和标准的C函数类似,但是除了包含可执行代码,他们也可以包含stack(栈,系统自动管理内存)或者heap(堆,手动管理内存)中的内存的变量。一个block可以保存一关于状态(数据的)的设置,所以当执行的时候block可以使用这些设置来影响行为。

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

你可以使用block来组合函数表达式来传递给API,随意存储,并被多个线程使用。block 经常被用作回调函数,因为block同时具有执行回调的代码和相应需要的数据。

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 languages (as well as Objective-C++). The syntax reflects this goal.

block在OS X 10.6 中的Xcode 开发者工具中的gcc 和clang是允许的。你可以在OS X v10.6 和 IOS 4.0 及以后版本中使用block。block运行时是开源的 你可以在LLVM’s compiler-rt subproject repository中找到 。block也在标准C工作中有展示见:N1370: Apple’s Extensions to C。因为objective-C和C++都是来源于C,block被设计成可以在这三种语言中运行(也可以在Objective-C++)。block的语法实现了这个目标。

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

你应该读这篇文档学习block对象是什么,和你如何在C,C++,objective-c中使用block。

Organization of This Document (block文档的组织)

 

This document contains the following chapters:

文档包括下列章节:
本文原创,转载请注明出处:http://blog.csdn.net/zhenggaoxing/article/details/44302505

Block相关文章

1: IOS block编程指南 1 介绍

block编程简介

2: IOS block编程指南 2 block开始

提供里一个快速实用的block介绍

3:IOS block编程指南 3 概念总览

提供了一个概念性的block的介绍

4:IOS block编程指南 4 声明和创建blocks

告诉你如何定义和实现block

5:IOS block编程指南 5 Block和变量

介绍了块和变量之间的内在关系,和定义_block 存储类型的修改

6:IOS block编程指南 6 Block的使用

Block使用相关


转载于:https://www.cnblogs.com/tenglong2500/p/4793762.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值