Re: abort() in libprotobuf due to missing required field

2009-03-24 Thread David Anderson
On Tue, Mar 24, 2009 at 4:11 PM, Caleb caleb.epst...@gmail.com wrote: On Mar 23, 7:16 pm, Kenton Varda ken...@google.com wrote: BTW, you should always compile with -DNDEBUG unless you are building a debug build.  It strips out several debug checks which makes things faster. Note that

abort() in libprotobuf due to missing required field

2009-03-23 Thread Dave Bailey
Hi, libprotobuf calls abort() if one attempts to serialize a message that is missing a required field. To me, this seems excessive, because it gives the calling code no opportunity to handle the error in a different way. Here is the bug report in protobuf-perlxs:

Re: abort() in libprotobuf due to missing required field

2009-03-23 Thread Kenton Varda
Well, note that if you compile with -DNDEBUG, the abort won't happen. We have a no-exception policy in C++, so I don't think we can replace this with an exception. Is -DNDEBUG good enough for you or do you want to look for another solution? On Mon, Mar 23, 2009 at 2:32 PM, Dave Bailey

Re: abort() in libprotobuf due to missing required field

2009-03-23 Thread Dave Bailey
Thanks Kenton. Yes, I read the Google style guide a while ago and was thoroughly entertained by the section on (the non-usage of) exceptions at Google ;-) Are there any performance implications of compiling generated code with -DNDEBUG? If not, I think it would be easy for me to add #define

Re: abort() in libprotobuf due to missing required field

2009-03-23 Thread Kenton Varda
Well, I think you misunderstood a few things about NDEBUG, however it's really not what you want to do anyway so I'm not sure why I suggested it. What you really want to do is call IsInitialized() yourself before you serialize, and then handle the error however you want. You can also use