Protobuf: oneof: generated code uses pointers for non-primitive types

Created on 19 Sep 2015  路  3Comments  路  Source: golang/protobuf

See: https://github.com/golang/protobuf/blob/535a10468679b4cf155f6a7afdf53b554633fc09/proto/testdata/test.pb.go#L2031

There's no need for this to be a pointer, since the union interface is implemented for a pointer of the wrapping struct. The downside of using a pointer here is that it results in an additional allocation.

Most helpful comment

This should be reopened and addressed.

All 3 comments

While what you say is true, it's a pointer for symmetry with all the other occurrences of messages.

Please just think about this for another few seconds before dismissing this.

This should be reopened and addressed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

junghoahnsc picture junghoahnsc  路  5Comments

khadgarmage picture khadgarmage  路  3Comments

aaabhilash97 picture aaabhilash97  路  4Comments

jonomacd picture jonomacd  路  3Comments

leduy99 picture leduy99  路  4Comments