philpearl / plenc

Go encoding based on protobuf, but hopefully easier to deal with
MIT License
28 stars 2 forks source link

Zeros and nils #6

Closed philpearl closed 2 years ago

philpearl commented 2 years ago

Plenc was not omitting zero value basic types. This meant it was writing much more data than it needed to from empty structs. But to fix this we run into issues distinguishing slices to pointers to all-zero structs from slices of nil pointers.

Our solution is to favour pointers to empty structs over nil pointers. This is better as nils in slices of pointers aren't in any case well supported.