We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
大神您好!我研读您的 kcp 协议代码,发现一处地方不太明白,具体是 ikcp.h 的 156~157 行。如下:
#define ICONTAINEROF(ptr, type, member) ( \ (type*)( ((char*)((type*)ptr)) - IOFFSETOF(type, member)) )
这里 ptr 是指向 member 的指针,而 type 是包含 member 成员的父结构类型,所以 (char*)((type*)ptr) 这个强制转换为 type* 的过程感觉有点儿奇怪,感觉有点儿多余。不知是否有什么特殊的技巧还是纯粹多写了一个强制转换?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
大神您好!我研读您的 kcp 协议代码,发现一处地方不太明白,具体是 ikcp.h 的 156~157 行。如下:
这里 ptr 是指向 member 的指针,而 type 是包含 member 成员的父结构类型,所以 (char*)((type*)ptr) 这个强制转换为 type* 的过程感觉有点儿奇怪,感觉有点儿多余。不知是否有什么特殊的技巧还是纯粹多写了一个强制转换?
The text was updated successfully, but these errors were encountered: