issues
search
isayme
/
blog
https://blog.isayme.org
MIT License
10
stars
2
forks
source link
Golang 空结构体(empty struct)
#18
Open
isayme
opened
5 years ago
isayme
commented
5 years ago
空结构体
指没有元素的结构体:
type s struct{}
特性
不占空间: sizeof(s{}) == 0
所有的实例的地址都相同: &s{} == &s{}
https://play.golang.org/p/Z-y-cGQgtkQ
参考资料
The empty struct
空结构体
指没有元素的结构体:
特性
https://play.golang.org/p/Z-y-cGQgtkQ
参考资料