Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
Description
src/AudioClip.cxx: In member function `virtual void
LiveSupport::Core::AudioClip::configure(const xmlpp::Element&)':
src/AudioClip.cxx:108: warning: suggest parentheses around assignment
used as truth value
LiveSupport::Core::AudioClip::configure(const xmlpp::Element&)':
src/AudioClip.cxx:108: warning: suggest parentheses around assignment
used as truth value
= someMethod()) { ... } to if ((x = someMethod())) { ... } Do
you really want me to change that?
OK, I put the extra parentheses in. My idea of clarity seems to
differ from gcc's, though.
the extra parenthesis here is to clearly mark your intent. compare
if (x = someMethod()) { ... } with if (x == someMethod()) { ...
} it's a very easy and common mistake to mistype == to =, and thus
change the effect of the code totally. with the extra parenthesis you
clearly mark that what you mean is an assignment, not a comparison.