XSSimpleTypeDefinition constructor - declaration and definition of a variable 
at the "if" check causes compiler error
---------------------------------------------------------------------------------------------------------------------

         Key: XERCESC-1379
         URL: http://issues.apache.org/jira/browse/XERCESC-1379
     Project: Xerces-C++
        Type: Bug
    Versions: 2.6.0    
 Environment: Solaris 2.8 with SPARCompiler 4.2
    Reporter: Maciek Samsel


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)


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to