ios – #pragma objective-c:你能不只是’标记’?

前端之家收集整理的这篇文章主要介绍了ios – #pragma objective-c:你能不只是’标记’?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我熟悉#pragma mark objective-c / xcode / ios开发,它对于查找代码段很有用.

但是,我想知道除了’mark’之外是否还有其他关键字.比如,你能做#pragma somethingelse吗?提前致谢!

解决方法

首先,一些例子:

>您可以控制诊断:

http://clang.llvm.org/docs/UsersManual.html#controlling-diagnostics-via-pragmas
>并从同一个链接

  • clang supports the Microsoft “#pragma pack” feature for controlling record layout. GCC also contains support for this feature,however where MSVC and GCC are incompatible clang follows the MSVC definition.

  • clang supports the Microsoft #pragma comment(lib,"foo.lib") feature for automatically linking against the specified library. Currently this feature only works with the Visual C++ linker.

  • clang supports the Microsoft #pragma comment(linker,"/flag:foo") feature for adding linker flags to COFF object files. The user is responsible for ensuring that the linker understands the flags.

但是,该列表中的第二个和第三个不适用于您的iOS代码.
>维基百科[link]说clang也支持#pragma一次.

最后,这是一个链接clang API documentation的pragma处理代码.您可以从那里浏览以查看其他所有内容.特别是,TokenKinds.def描述了所有被接受的令牌,因此可能是完整的:

#pragma unused
#pragma GCC visibility [push/pop]
#pragma pack [value/show/push/pop/etc/etc/etc]
#pragma clang __debug parser_crash
#pragma clang __debug captured
#pragma ms_struct [on/off]
#pragma align [native/natural/mac68k/power/reset]
#pragma weak [identifier]
#pragma weak [identifier = identifier] // alias
#pragma redefine_extname [identifier identifier]
#pragma STDC FP_CONTRACT
#pragma OPENCL EXTENSION
#pragma omp [...]
#pragma detect_mismatch
#pragma comment

解析代码(见于ParsePragma.cpp)似乎表明并非所有这些代码都已实现,即使前端接受它们也是如此.

原文链接:https://www.f2er.com/iOS/333763.html

猜你在找的iOS相关文章