Skip to content

变量作用域 #95

Closed Answered by hshq
daiwhea asked this question in 新手提问
Discussion options

You must be logged in to vote
  1. res 在栈中,这符合没有隐式内存分配的原则;也因此返回后自然会无效;
    返回的是 T 类型,不是 *T ,T 的内容整个拷贝返回了,销毁不存在问题。

  2. sliceAsBytes 需要切片,所以用 [1]T 而不是 T 是很自然的做法吧。

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by daiwhea
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants