Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.6.0
-
None
-
None
-
Solaris 2.8 with SPARCompiler 4.2
Description
Line 100, File: xerces-c-src_2_6_0/src/xercesc/framework/psvi/XSSimpleTypeDefinition.cpp
This is bad style of programming and what's more it will not work with a few compilers. You are not supposed to define and assign value inside "if" construct. Commercial SPARCompiler 4.2 reports error of malformed line and does not allow to complete.
Although rich language syntax of C++ allows for many approaches some of them are not the best and should be avoided. The readabilty of the code is the main principle as we departure from obfuscated ways of writing expressions inherited from C programming styles like 20 years ago.
Please fix line:
if (int finalset = fDatatypeValidator->getFinalSet())
replacing it with:
int finalset = fDatatypeValidator->getFinalSet();
if (finalset)
(it is a local variable used in that block only so there is no conflicts).
Anyway how much performance do you gain with that check? (see the code after it)