Hi Robert, Matthew et al., IMHO, the "!=0" syntax in a "if" statement is the most portable. I know "if ((a=b)!=0)" does not generate warning under MSVC and GCC. So I guess it would be the same for "if ( (a = fxn()) != 0 )". For my part, I always use the "!=0" syntax... and I avoid as much as possible the affectations in a "if" statement by splitting the instruction. :)
Cheers, Sukender PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/ Le Wed, 07 Jan 2009 17:51:58 +0100, Robert Osfield <[email protected]> a écrit: > Hi Matthew, > > On Wed, Jan 7, 2009 at 4:36 PM, Matthew Fuesz <[email protected]> wrote: >> Blanket-supression of C4706 isn't really a good thing, since as you pointed >> out, it can actually point out an error (usually a typo by the developer). >> C4706 will not be generated if it is made explicitly clear what the intent >> of the conditional is. >> >> i.e., instead of checking "if ( a = fxn() )", check "if ( (a = fxn()) != 0 >> )". This is covered in the MSDN page on C4706. >> >> I actually prefer the latter syntax (which doesn't generate C4706) anyway, >> since it eliminates any possible confusion as to the intended operations. > > All the instances if assignment in condtionaly already have a () added > around the conditional to avoid the warning under gcc, I had hoped > that this would be the end of it... but no... > > Personally I've got others things to chase up right now that are more > important than adding more superfluous code to the OSG to fix silly > warnings that have no relevance to fixing bugs in the OSG. Feel free > to dive in if you feel so inclined, otherwise I'll be happy to stick > with the surpression of this warning under VS. > > Robert. > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

