随笔分类 -  Mac/iOS

 
Objective-C 与 C++ 的异同
摘要:转自:http://www.cppblog.com/kesalin/archive/2010/12/26/compare_objective_c_and_c_plus_plus.html 阅读全文
posted @ 2013-02-27 14:13 做个不善的人 阅读(194) 评论(0) 推荐(0)
Objective-C 的Compiler Directives
摘要:Objective-C 中使用@来表示其对C语言的扩展,由编译器提供支持,也叫做compiler directives,比如@interface, @implementation等,下面一一介绍:@interface相当于类的声明,像是C++中.h文件中包含的类声明信息。跟Java中的interface是不一样的。interface file就是.h文件。在声明一个新类时,可以注意一下信息:使用@public @protected @private来控制变量或者方法是否对外可见;使用 ‘+’ 修饰的方法是 method for class(类似于C++ 的static method),只能使用 阅读全文
posted @ 2013-02-27 12:58 做个不善的人 阅读(528) 评论(0) 推荐(0)
Objective-C的Runtime System (转载)
摘要:[0] Outline -- [1] 版本和平台 -- [2] 与Runtime System交互 -- [3] 方法的动态决议 -- [4] 消息转发 -- [5] 类型编码 -- [6] 属性声明 [1] 版本和平台Runtime System对于Objective-C来说就好比是它的操作系统,或者说是运行的支撑平台,它使得Objective-C代码能够按照既定的语言特性跑起来。相对于C/C+... 阅读全文
posted @ 2013-02-26 16:44 做个不善的人 阅读(394) 评论(0) 推荐(0)
Objective-C Runtime的数据类型
摘要:ClassObjective-C是支持反射的,先来了解一下其如何表达一个类。在Objective-C的Runtime中有个类型是Class(只在Runtime环境中使用),用来表示Objective-C中的类,其定义为:typedef struct objc_class *Class;可以看出,其实Class类型是一个指针,指向struct objc_class,而struct objc_class才是保存真正数据的地方,再看struct objc_class的声明(from http://www.opensource.apple.com/source/objc4/objc4-493.9/ru 阅读全文
posted @ 2013-02-26 14:50 做个不善的人 阅读(4461) 评论(0) 推荐(0)
Xcode基础
摘要:刚开始用Xcode还是没那么顺溜的,功能是一方面的,还有就是那几个界面,不小心关了就怎么也找不回去了,下面先介绍一下这些知识吧(本文使用XCode 4.3.3)。 Xcode中有几个Navigator:Project Navigator(Coding时最常用的), Symbol Navigator, Search Navigator, Issue Navigator, Debug Navigato... 阅读全文
posted @ 2013-02-25 17:08 做个不善的人 阅读(2228) 评论(0) 推荐(0)
进入Mac OSX的第一步
摘要:先来理解一些概念 a microkernel (also known as μ-kernel) is the near-minimum amount of software that can provide the mechanisms needed to implement an operating system (OS)。在20世纪80年代,传统的mono-kernels遇到了很多挑战(不断的... 阅读全文
posted @ 2013-02-25 13:30 做个不善的人 阅读(473) 评论(0) 推荐(0)
Linux 信号
摘要:SIGSEGV与SIGBUSSIGBUS(Bus error)意味着指针所对应的地址是有效地址,但总线不能正常使用该指针。通常是未对齐的数据访问所致。SIGSEGV(Segment fault)意味着指针所对应的地址是无效地址,没有物理内存对应该地址。SEGV_MAPERR, 地址没有映射到对象,可能的原因是dangling pointer或者overflow,比如1. ptr1和ptr2指向同一段内存,但是某个线程某个时刻用ptr1将内存delete了,如果因为错误的设计或者假设导致认为ptr2还是指向合法的内存,使用时就会出错;2. 某个数组有1个元素,但是传入的数组大小却是2,如果我们要 阅读全文
posted @ 2013-01-07 10:44 做个不善的人 阅读(9091) 评论(0) 推荐(2)
dscl on Mac
摘要:Directory Service command line utilityCreate, read, and manage Directory Service data. If invoked without any commands, dscl runs in an interactive mode, reading commands from standard input. Interactive processing is terminated by the quit command. (dscl and the GUI 'Directory utility' repl 阅读全文
posted @ 2012-04-21 14:44 做个不善的人 阅读(8555) 评论(0) 推荐(0)
Time/Timer in Linux vs. Windows
摘要:数据类型time_t: Calendar time#include <time.h>time_t time(time_t *t);[obsoleted by gettimeofday]获取自从1970.1.1 00:00:00到现在为止的时间,以秒为单位。#include <sys/timeb.h>int ftime(struct timeb *tp);[Obsoleted]#include <time.h>int clock_getres(clockid_t clk_id, struct timespec *res);int clock_gettime(c 阅读全文
posted @ 2011-04-01 17:09 做个不善的人 阅读(2448) 评论(0) 推荐(0)
Dynamic Linking Loader in Linux
摘要:The four functions dlopen(), dlsym(), dlclose(), dlerror() implement the interface to the dynamic linking loader.#include <dlfcn.h>void *dlopen(const char *filename, int flag);char *dlerror(void);void *dlsym(void *handle, const char *symbol);int dlclose(void *handle);dlerrordlerror() 返回一个适合程序员 阅读全文
posted @ 2011-04-01 14:56 做个不善的人 阅读(1438) 评论(0) 推荐(0)