On Thu, May 28, 2009 at 12:17 PM, Marc Gravell <marc.grav...@gmail.com>wrote:

> A couple of questions on the new packed encoding;
> 1: do the core implementations complain if the body length is given as
> zero? i.e. no items? I don't expect they would *write* this, but would
> they be happy to *read* it? In particular, I've had multiple, multiple
> requests about explicit empty vs implicit empty, and it seems that a
> packed item with zero items is a handy way of expressing "explicit
> empty" (even if it only works for int etc).

A packed value of zero length is valid.  However, implementations should not
distinguish between a packed value with zero elements and seeing no packed
value at all.  No other protocol buffers implementation will ever make this
distinction, so if you make it in yours, and your users depend on this
feature, then they will not be able to interoperate correctly with other
implementations.  This would sort of defeat the purpose of using the
protocol buffers encoding in the first place.

> 2: if multiple packed blocks for the same tag are found, I assume that
> the items are concatenated (and not that the second block *replaces*
> the first). Is this correct?

Yes -- I believe that's in the docs.

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 
For more options, visit this group at 

Reply via email to