Re: [protobuf] Why doesn't C++ libpropobuf accept defult values?

2017-07-01 Thread Henner Zeller
Required really means that you need to store values in there. Default only makes sense for the optional fields (because only in the optional fields, it is possible to _not_ set a value, so in that case, you get the default). That answers your question in which cases you use defaults. So sounds

[protobuf] Why doesn't C++ libpropobuf accept defult values?

2017-07-01 Thread hce h
Hi, In my process of response message, if there is an error, the process would be aborted and send back an error response message without filling the required variables. To avoid the libpropobuf throws system exception for missing required variables, I put the default values like following