List of all Objective-C preprocessor directives in Clang

半世苍凉 提交于 2019-12-07 05:13:34

问题


Is there some list of all Objective-C preprocessor directives in Clang? I'm talking about #pragma mark - Section I or #pragma unused (variableName) or #warning - message.

I would like to know more of them to improve my code, but Googling "llvm preprocessor directives" gave me this link: http://clang.llvm.org/docs/UsersManual.html, which does not list all the directives.


回答1:


Most of them have not been introduced in LLVM/Clang, but were inherited from GCC. Therefore, searching for gcc preprocessor directives may lead to better results. The following document could give you some hints, but it does not seem to be complete (missing some of the above mentioned pragmas) nor is it specific to Objective-C:

http://gcc.gnu.org/onlinedocs/cpp/index.html#Top

This index may be faster to browse:

http://gcc.gnu.org/onlinedocs/cpp/Index-of-Directives.html#Index-of-Directives




回答2:


Interfaces & Implementation

@interface...@end
@implementation...@end
@class

Instance Variable Visibility

@public
@package
@protected
@private

Properties

@property
@synthesize
@dynamic

Protocols

@protocol
@required
@optional

Exception Handling

@try
@catch
@finally
@throw

Object Literals

@""
@42, @3.14, @YES, @'Z'
@[]
@{}
@()

Objective-C Literals

@selector()
@protocol()

C Literals

@encode()
@defs()

Optimizations

@autoreleasepool{}
@synchronized{}

Compatibility

@compatibility_alias

Taken from the following link which has an exhaustive list of directives with descriptions: NSHipster - @ Compiler Directives.



来源:https://stackoverflow.com/questions/17988244/list-of-all-objective-c-preprocessor-directives-in-clang

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!