On Mon, Mar 7, 2016 at 3:53 PM, Seth Humphries <[email protected]> wrote:

> I will post as an issue if the discussion fails to shed more light on this
>
> In syntax proto2, I mark each element as optional. In proto3, all elements
> are considered optional by default. The error seems to be from proto3
> improperly checking for element existence.
>
In proto2, when a message is serialized, the serialization routine will
check the has-bits to determine whether a field is set and only serialize
set fields. However, in proto3, we removed has-bits, so the serialization
routine can't check the has-bits. As a workaround, we instead check whether
the field is set to a non-zero value. That's why proto3 has these "field ==
0" comparisons but proto2 doesn't. They are there intentionally, but we may
be able to write it in a way that can avoid the float-equal warnings.


>
>
> On Monday, March 7, 2016 at 3:41:49 PM UTC-7, Feng Xiao wrote:
>>
>> Hi Seth,
>>
>> Could you help submit this as a github issue?
>> https://github.com/google/protobuf/issues
>>
>> Do you know how we can modify the generated code to avoid this
>> "float-equal" warning? If you know of a solution, feel free to send us a
>> patch to fix the code:
>>
>> https://github.com/google/protobuf/blob/master/src/google/protobuf/compiler/cpp/cpp_message.cc#L314
>>
>> On Fri, Mar 4, 2016 at 4:42 PM, Seth Humphries <[email protected]> wrote:
>>
>>> I forgot to add that this occurs after proto buffer generates the pb.h
>>> and pb.c files. This error occurs inside the generated files when I attempt
>>> to compile them.  ie the error gives the .pb.c file and line number.
>>> --
>>> 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 [email protected].
>>> To post to this group, send email to [email protected].
>>> 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 [email protected].
> To post to this group, send email to [email protected].
> 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to