给定保留字段标签的 proto2 中的默认枚举值是多少?
What is the default enum value in proto2 given reserved field tags?
假设您在 proto2 中有以下枚举。
enum my_enum {
reserved 0;
VALUE = 1;
ANOTHER = 2;
}
我的问题是...在没有定义默认值的情况下,默认枚举值是多少?在它说的文档中,
For enums, the default value is the first value listed in the enum's type definition.
... "first value" 是指 0
(保留)还是 1
?
我刚刚在我的代码中用
测试了这个
message my_enum {
enum my_service {
reserved 0;
VALUE = 1;
}
optional my_service selected_service = 1;
}
它默认为 VALUE
(即 1)而不是 0。
假设您在 proto2 中有以下枚举。
enum my_enum {
reserved 0;
VALUE = 1;
ANOTHER = 2;
}
我的问题是...在没有定义默认值的情况下,默认枚举值是多少?在它说的文档中,
For enums, the default value is the first value listed in the enum's type definition.
... "first value" 是指 0
(保留)还是 1
?
我刚刚在我的代码中用
测试了这个message my_enum {
enum my_service {
reserved 0;
VALUE = 1;
}
optional my_service selected_service = 1;
}
它默认为 VALUE
(即 1)而不是 0。