[問題] __attribute__

看板MacDev作者 (狗狗)時間12年前 (2013/08/18 16:12), 編輯推噓0(002)
留言2則, 1人參與, 最新討論串1/1
http://nshipster.com/__attribute__/ 查了一下 在 GCC 時代 可以用__attribute__ 來檢查傳入的 parameter 是否為 null 來進行 compile time的提醒 例如: extern void *my_memcpy (void *dest, const void *src, size_t len) __attribute__((nonnull (1, 2))); 在現在的 LLVM 底下,有辦法在 compile time 時對 Obj-C message 做一樣的事情嗎? 例如: + (void) managerWithIdentifier:(NSString*)identifier __attribute__(nonnull (1)); 這樣寫好像不會進行 compile time check... -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 223.142.142.72

08/19 10:43, , 1F
我覺得這不是 __attribute__ 的問題, 是 compiler 不會檢
08/19 10:43, 1F

08/19 10:44, , 2F
查 Objective-C message...
08/19 10:44, 2F
文章代碼(AID): #1I487mZ1 (MacDev)
文章代碼(AID): #1I487mZ1 (MacDev)