Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@BeeHiveService 前面的@ 可以理解调用宏定义吗 #140

Open
jj89757hhb opened this issue Jul 8, 2019 · 4 comments
Open

@BeeHiveService 前面的@ 可以理解调用宏定义吗 #140

jj89757hhb opened this issue Jul 8, 2019 · 4 comments

Comments

@jj89757hhb
Copy link

@BeeHiveService(UserTrackServiceProtocol,BHUserTrackViewController)

#define BeeHiveService(servicename,impl)
class BeeHive; char * k##servicename##_service BeeHiveDATA(BeehiveServices) = "{ ""#servicename"" : ""#impl""}";

@lyandy
Copy link

lyandy commented Jul 9, 2019

@BeeHiveService(UserTrackServiceProtocol,BHUserTrackViewController)

#define BeeHiveService(servicename,impl)
class BeeHive; char * k##servicename##_service BeeHiveDATA(BeehiveServices) = "{ ""#servicename"" : ""#impl""}";

不是的
实际上是 @ 和 宏里面的 class BeeHive 字符串拼接成 一个 forward class 类的声明 @class BeeHive

@jj89757hhb
Copy link
Author

哦 , 那 ## 是什么意思呢

@lyandy
Copy link

lyandy commented Jul 10, 2019

哦 , 那 ## 是什么意思呢

## 是宏字符串连接

@JianboYan
Copy link

哦 , 那 ## 是什么意思呢

## 是宏字符串连接

其实不能叫字符串连接,应该算是字面量连接,毕竟是不带引号的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants