Re: [protobuf] Can I memcpy protobuf C++ objects if they only contain fixed length fields?

2016-05-14 Thread Yan Yan
ty

On Sunday, May 15, 2016 at 7:25:07 AM UTC+8, Feng Xiao wrote:
>
> On Sat, May 14, 2016 at 8:13 AM, Yan Yan  
> wrote:
>
>> No strings, no int64, no int32, no repeated fields.
>> Only sfixed64, sfixed32, nested messages.
>> Are there any dynamic allocation?
>>
> Yes.
>  
>
>> Are there any pointers?
>>
> Yes.
>  
>
>> Is there a subset of protobuf datatypes that I can use to make fixed size 
>> objects that works on memcpy?
>>
> No. Even a complete empty protobut message cannot be memcpy.
>  
>
>> Will the sizeof() operator work? Ideally they should work like C structs 
>> of fixed size, and they come with a higher level API. The wire format is 
>> good for cross-language compatibility. Thx.
>>
> Protobuf C++ objects are not POD and you can't memcpy it.
>  
>
>> -- 
>> 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+u...@googlegroups.com .
>> To post to this group, send email to prot...@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.


Re: [protobuf] Can I memcpy protobuf C++ objects if they only contain fixed length fields?

2016-05-14 Thread 'Feng Xiao' via Protocol Buffers
On Sat, May 14, 2016 at 8:13 AM, Yan Yan  wrote:

> No strings, no int64, no int32, no repeated fields.
> Only sfixed64, sfixed32, nested messages.
> Are there any dynamic allocation?
>
Yes.


> Are there any pointers?
>
Yes.


> Is there a subset of protobuf datatypes that I can use to make fixed size
> objects that works on memcpy?
>
No. Even a complete empty protobut message cannot be memcpy.


> Will the sizeof() operator work? Ideally they should work like C structs
> of fixed size, and they come with a higher level API. The wire format is
> good for cross-language compatibility. Thx.
>
Protobuf C++ objects are not POD and you can't memcpy it.


> --
> 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.