-
Notifications
You must be signed in to change notification settings - Fork 425
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
代码疑问咨询 #546
Comments
GPT4 这段代码涉及到Go语言中的unsafe包,用于进行低级的内存操作。在这个代码片段中,有几个关键点需要理解:
现在来解释为什么不能直接使用ret.base = unsafe.Pointer(sliHeader.Data)):
简而言之,这种转换方法是为了在使用unsafe包进行内存操作时,尽可能地保持类型信息,从而确保程序的安全性和稳定性。直接从uintptr到unsafe.Pointer的转换可能会绕过Go的类型系统和垃圾回收机制,从而引入潜在的风险。 |
作者大大好,我是新手,在通过您的代码学习滑动窗口实现,在读时候遇到一个疑问,不知道可不可以帮忙解答
这是
NewAtomicBucketWrapArrayWithTime
函数的最后两行请问为什么给
base
赋值时要用到util.SliceHeader
,为什么不可以直接这样呢The text was updated successfully, but these errors were encountered: