2020-10-01: Talk about the empty structure of golang.

Fu Ge's answer 2020-10-01: #福大Architects Daily One Question#

1.map.
value is an empty structure, which constructs a collection.

2. Channel.
Only transmit signals, not data.

3. Slice.
No matter how long the slice is, it will not take up space.

4. Structures that only contain methods.
No pointers, save space.

5. The last zero field.
final zero field: If the last attribute in the structure is an empty structure, it will be treated as 1 byte. If the structure nested is all empty structures, it is still 0 bytes.


comment

Guess you like

Origin blog.csdn.net/weixin_48502062/article/details/108897429