Trying to make my own class generator for ProtoBuf (no “standard” for Delphi), I came across an interesting note: Using proto2 Message Types

proto2 enums cannot be used in proto3 syntax.

Question: why?

Syntax enum, as far as I can see, is no different in version 2 and version 3

In binary content (although there is nothing about encoding in the mention of incompatibility) - there is no separation between versions , everything is represented as varint

So what exactly is incompatibility expressed in?

    1 answer 1

    The only difference between enum in version 2 and 3 is in the phrase (v3)

    Enum definitions must start with enum value zero.

    Source: ProtoBuf v3 specification . The rest - the syntax is the same .

    It is rather strange that the manual uses a categorical statement about incompatibility, although enum in version 2 can also be started from zero. Those. in my opinion, the phrase should have sounded like "if enum v2 does not start with an element with a value of 0, it cannot be used in v3"

    • Yes, in addition. I don’t know, advertising is not advertising, but I’ve finished my generator: github.com/kami-soft/ProtoBufGenerator I use it already in several projects, the flight is normal. - kami