On Feb 24, 2:57 pm, Leon Mergen <l...@solatis.com> wrote:
> After a bit of a search on the site of protocol buffers I was unable
> to see what the behavior of the serialization of unset fields is (that
> is, has_field () == false). Will they be skipped entirely from
> serialization, and thus take up no space at all, or will they still be
> defined in the serialization in some way ?

Guess browsing through the code gave me my answer -- it seems like all
Serialization functions eventually end up to the
SerializeWithCachedSizes function of a message, and in that function I
see a lot of:

if (_has_bit ()) { DO_(); }

calls, from which I conclude that, if has_field () == false, there
will not be a call to serialize that field at all, and it will not
waste any space.

Regards,

Leon Mergen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to