Hello,In my cpp proto3 project I am using enums that are wrapped in messages to avoid namespace collisions. See for example:message Physics {enum Enum {STRUCTURAL = 0;THERMAL = 1;}}In c++ I can refer to it by Physics::STRUCTURAL which is great.In this case, the Physics message does not have any fields. It derives from google::protobuf::Message or MessageLite and has some generated methods that are not relevant. In a project with several thousand enums, this could create binary bloat when compiled.
Does it make sense for protoc to identify messages that are simply there to wrap enums and provide a lighter api for it?
Or more generally to identify messages that do not have fields and derive from something even smaller than MessageLite?Thanks,Mohamed KoubaaSoftware DeveloperAnsys Inc
--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
To post to this group, send email to prot...@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.
Hi Feng,I didn't think about the use case of passing empty messages. No, I have not measured the binary size impact. Actually I was more annoyed by my IDE suggesting all of the inherited message methods when I really only wanted to see the enum values.If a binary size impact is measurable and poses a problem for us we could suggest some workarounds - but I don't see this in the near future.A possibility is annotating the messages in the proto file as 'enum wrappers' for protoc to deal with them differently. Alternatively, enum messages could be annotated with a namespace.