Since no one has responded... I just encountered this in a project that uses TinyXML too. I agree with Carolyn that the parentheses should go around the ||'s even though that is not what the compiler is currently doing. I don't think it will cause issues either way, but I suspect the current behavior is not what was intended. Just in case it would help anyone, here is a patch generated from our project SVN server:
Compiling tinyxml with gcc 4.3.0 gives the following compiler warning:
tinyxmlparser.cpp:357: warning: suggest parentheses around && within ||
The offending line of code is
while ( *p && IsWhiteSpace( *p ) || *p == '\n' || *p =='\r' )
I think it should read
while ( *p && (IsWhiteSpace( *p ) || *p == '\n' || *p =='\r') )
Without any brackets the compiler will evaluate it (I think) as
while ( (*p && (IsWhiteSpace( *p )) || *p == '\n' || *p =='\r' )
Projects which compile with -Werror will have problems.
Carolyn
Since no one has responded... I just encountered this in a project that uses TinyXML too. I agree with Carolyn that the parentheses should go around the ||'s even though that is not what the compiler is currently doing. I don't think it will cause issues either way, but I suspect the current behavior is not what was intended. Just in case it would help anyone, here is a patch generated from our project SVN server:
http://crownandcutlass.svn.sourceforge.net/viewvc/crownandcutlass/trunk/CrownCutlass/src/tinyxmlparser.cpp?r1=1068&r2=1067&view=patch&pathrev=1068
Please let me know if that is not actually correct.