rwl / protobuf-matlab

Automatically exported from code.google.com/p/protobuf-matlab
Other
1 stars 0 forks source link

how to avoid: Warning: Required field not set while parsing. This is an error. #6

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
running the code sample gives:
Warning: Required field not set while parsing. This is an error. 
upon the 1st call with an empty buffer 

bob = pb_read_Person();

The field is later set. Ideally, the warning shouldn't be there during the 
initial empty construction of bob. Instead there should be a final check on the 
constructed object that checks all required fields are set (could be 
recursive). And then one can throw error instead of warning. 
That should work right?

Original issue reported on code.google.com by timot...@google.com on 17 Jan 2013 at 5:55

GoogleCodeExporter commented 9 years ago
I agree that this warning is useless when you're creating a new message. I also 
agree that an error should be thrown if a required field remains unset during 
encoding. The two attached m-files can be dropped into 
"protobuf-matlab/protobuflib/" to achieve the desired behavior.

Original comment by chad.s.g...@gmail.com on 16 Oct 2013 at 7:56

Attachments: