On Mon, Jan 22, 2018 at 3:08 PM, Ashwin Kini <ashwinkin...@gmail.com> wrote:

> 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.

Reply via email to