Note that SerializeToArray performs an assertion to check that the all
required fields are present:
https://github.com/google/protobuf/blob/master/src/google/protobuf/message_lite.cc#L321
But
GOOGLE_DCHECK assertions are not enabled for optimized builds since they
take effect only if NDEBUG is not defined.

On Fri, Jul 1, 2016 at 3:27 PM, 'Bo Yang' via Protocol Buffers <
protobuf@googlegroups.com> wrote:

> You can call IsInitialized on Message
>
> On Fri, Jul 1, 2016 at 2:50 PM SAMEER CHAUDHARI <
> sameer.m.chaudh...@gmail.com> wrote:
>
>> I am using protobuf ver 2.6.
>>
>> Also what is the best way to check all required fields are present before
>> serialize Message.
>> Instead of checking every required field by has_fieldName.
>>
>>
>> On Friday, 1 July 2016 17:46:03 UTC-4, SAMEER CHAUDHARI wrote:
>>>
>>> I am using C++ for Protocol buffer for both encoding & decoding.
>>>
>>> ParseFromArray failed if required field are missing.
>>> However SerializeToArray returns true eventhough required fields are
>>> missing .
>>>
>>> I am curious to know,
>>> Why does SerializeToArray returns true (Eventhough required fieds are
>>> missing) ?
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Protocol Buffers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to protobuf+unsubscr...@googlegroups.com.
>> To post to this group, send email to protobuf@googlegroups.com.
>> Visit this group at https://groups.google.com/group/protobuf.
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to