看板 MacDev 關於我們 聯絡資訊
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
uranusjr:我覺得這不是 __attribute__ 的問題, 是 compiler 不會檢 08/19 10:43
uranusjr:查 Objective-C message... 08/19 10:44