Yes and no....
The wire type encodings are all varint - so yes it is wire compatible.
"Since enum values use varint encoding on the wire" -http://
code.google.com/apis/protocolbuffers/docs/proto.html#enum
However protobuf treats enums a little differently at runtime...
an integer value (int32, etc) is valid as long as it is in range...
while an enum literal is considered an "Unknown Field" if it does not
resolve to a known enum literal.
That is to say that an application expecting the enum will fail to
recognize that the field is even set (unless you're using protocol
buffers 'reflection' and look for it manually) if the value is not one
of the enum literals.
Going enum -> int32 = no loss of data
Going int32 -> enum = possible missing fields (all used values must
have a literal associated with them)
On Sep 30, 11:17 am, Josh Kelley <
josh...@gmail.com> wrote:
> Are enums compatible with ints? For example, can I serialize an int now and
> change it to an enum later without losing the ability to parse old
> messages? Underhttp://
code.google.com/apis/protocolbuffers/docs/proto.html#updating, it