Hello Kenton,

Thanks for your reply. I actually read that text earlier, but didn't
get what you're saying from that text (still don't), probably because
it's kind of abstract. My guess is that you're talking about this:

"If any of your elements are optional, the encoded message may or may
not have a key-value pair with that tag number. "

Anyway, thanks for the confirmation!

Regards,

Leon Mergen

On Feb 24, 6:32 pm, Kenton Varda <[email protected]> wrote:
> You are correct.  Optional fields are not sent if they are not set.  This is
> documented here:
>
> http://code.google.com/apis/protocolbuffers/docs/encoding.html#optional
>
> On Tue, Feb 24, 2009 at 6:32 AM, Leon Mergen <[email protected]> wrote:
>
> > On Feb 24, 2:57 pm, Leon Mergen <[email protected]> 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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to