如何在 Objective-C 宏中使用商业 at 登录? [英] How can I use commercial at sign in Objective-C macro?
本文介绍了如何在 Objective-C 宏中使用商业 at 登录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在 Objective-C 宏中使用商业 at 登录?
How can I use commercial at sign in Objective-C macro?
我知道不建议这样做,但似乎有可能吗?由于libextobjc
提供@weakify
、@strongify
等...
I know it is not recommended, but seems it is possible somehow? Since libextobjc
provides @weakify
, @strongify
, etc...
推荐答案
libextobjc
使用预处理器诡计让你认为它是一个 @command
.
libextobjc
uses preprocessor trickery to make you think it's an @command
.
#define weakify(...)
try {} @finally {}
metamacro_foreach_cxt(ext_weakify_,, __weak, __VA_ARGS__)
注意 try
上缺少的 @
.所以 @weakify
扩展为 @try {} @finally {} [注入代码]
.
Note the missing @
on the try
.
So @weakify
expands into @try {} @finally {} [injected code]
.
您可以使用相同的技巧,但我建议您坚持使用普通宏.
You could use the same trick, but I suggest you stick with plain macros.
这篇关于如何在 Objective-C 宏中使用商业 at 登录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文