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

空struct引发的一些探索 | 朱晓峰 #9

Open
shafferjohn opened this issue Nov 23, 2020 · 0 comments
Open

空struct引发的一些探索 | 朱晓峰 #9

shafferjohn opened this issue Nov 23, 2020 · 0 comments

Comments

@shafferjohn
Copy link
Owner

https://shaffer.cn/golang/insights-into-empty-struct/

背景偶然发现项目代码中有如下的写法: 12345678type Student struct { Name string Age int}func NewStudent(s Student) *Student { return &s} 我们且不去探讨“这样写法有什么作用”、“为什么要这样写”,我们先就代码本身讨论。 众所周知,从严格意义上来说,go

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

No branches or pull requests

1 participant