Re: [protobuf] Tags and values
On Mon, Jan 22, 2018 at 3:08 PM, Ashwin Kiniwrote: > Hi all, > > While defining messages can the *tags *be non continous? The > documentation never mentions the same > > message abc { > optional uint32 xyz = *100*; > optional uint32 def = *200*; > optional unit32 abc = *0xDEAD01*; > > } > > The documentation says it needs to be unique. Agreed. Can they be non > continous as explained in example? > It can, but I would not recommend it. You should generally make the tag numbers as small as possible and as dense as possible. Smaller tags need less bytes to encode and dense tags allow compiler to optimize the parsing switch case better. > . Also does it take HEX values as far as it falls in the range mentioned > in the doc? > It should be supported. > > One more question is, can repeated fields be made required? > The general recommendation is not to use required fields, however if you have a way to guarantee that all repeated fields have at least one element, changing it to required should be wire compatible. > I did a lot of digging, seems its not possible. Can anybody confirm? I > understand required should be completely avoided. > > > > > -- > 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+unsubscr...@googlegroups.com. > To post to this group, send email to protobuf@googlegroups.com. > Visit this group at https://groups.google.com/group/protobuf. > For more options, visit https://groups.google.com/d/optout. > -- 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+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
Re: [protobuf] Tags and values
Yes, tags (field numbers) can be non-contiguous. Yes, hex is accepted by protoc No, repeated fields cannot be required On 22 January 2018 at 23:08, Ashwin Kiniwrote: > Hi all, > > While defining messages can the *tags *be non continous? The > documentation never mentions the same > > message abc { > optional uint32 xyz = *100*; > optional uint32 def = *200*; > optional unit32 abc = *0xDEAD01*; > > } > > The documentation says it needs to be unique. Agreed. Can they be non > continous as explained in example? . Also does it take HEX values as far > as it falls in the range mentioned in the doc? > > One more question is, can repeated fields be made required? I did a lot of > digging, seems its not possible. Can anybody confirm? I understand required > should be completely avoided. > > > > > -- > 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+unsubscr...@googlegroups.com. > To post to this group, send email to protobuf@googlegroups.com. > Visit this group at https://groups.google.com/group/protobuf. > For more options, visit https://groups.google.com/d/optout. > -- Regards, Marc -- 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+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
[protobuf] Tags and values
Hi all, While defining messages can the *tags *be non continous? The documentation never mentions the same message abc { optional uint32 xyz = *100*; optional uint32 def = *200*; optional unit32 abc = *0xDEAD01*; } The documentation says it needs to be unique. Agreed. Can they be non continous as explained in example? . Also does it take HEX values as far as it falls in the range mentioned in the doc? One more question is, can repeated fields be made required? I did a lot of digging, seems its not possible. Can anybody confirm? I understand required should be completely avoided. -- 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+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.