Comment #4 on issue 361 by [email protected]: Fix warnings
http://code.google.com/p/protobuf/issues/detail?id=361
C4800: 'google::protobuf::uint64' : forcing value to bool 'true' or 'false'
This is simple write the correct expression.
Generates warning:
uint64 x = 1;
bool a = x;
No warning, and makes code more readable.
uint64 x = 1;
bool a = x != 0;
About this in base member initializer list, it can be problem and can be
false alarm.
It depends.
Problematic code:
// Some interface
class I { virtual void Do() = 0; };
class A { public: A(I& i) { i.Do(); } };
class B : public A { public: B() : A(*this) { } } // BOOM !
Non problematic code, in case we just store reference/pointer.
// Some interface
class I { virtual void Do() = 0; };
class A { public: A(I& i) : _i(i) { } private: I& _i; };
class B : public A { public: B() : A(*this) { } } // No problems.
If it is the second case, disable warning by
#pragma warning(push)
#pragma warning(disable: 4355)
... Code
#pragma warning(pop)
Of course it is for MSVC, I don't know if GCC complains about it.
--
You received this message because you are subscribed to the Google Groups "Protocol
Buffers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/protobuf?hl=en.