Ignore the data (sort of): The unknown value gets treated as an unknown
field, leaving the enum field unset. In implementations that support
propagation of unknown fields (non-lite C++, Java), the value is added to
the UnknownFieldSet.

Implications:
- a sender may set a required enum field to a valid value, according to its
defintion of the .proto. If the recipient doesn't know about that value, the
message may fail to parse. It's best to avoid required enums
- by treating it as an unknown field, a message can be sent between two
programs who understand a particular enum value through a middleman that
doesn't, and there is no loss of data

On Wed, May 11, 2011 at 2:47 PM, Marc Gravell <marc.grav...@gmail.com>wrote:

> I'm doing some code maintenance on my protobuf library, and I have
> encountered a test that is... confusing me. So before I go crazy (/
> crazier)... what should an implementation do if during deserialization
> it gets an enum it doesn't recognise?
>
> - to explode in sparks?
> - to ignore the data?
> - to brutally coerce the data to the unexpected value?
> - other?
>
> Thanks in advance
>
> Marc
>
> --
> 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.
>
>

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