trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From selvaganesang <...@git.apache.org>
Subject [GitHub] trafodion pull request #1311: [TRAFODION-2818] For Server 2008, function pow...
Date Fri, 05 Jan 2018 02:03:32 GMT
Github user selvaganesang commented on a diff in the pull request:

    https://github.com/apache/trafodion/pull/1311#discussion_r159798296
  
    --- Diff: win-odbc64/odbcclient/drvr35/sqltocconv.cpp ---
    @@ -36,6 +36,36 @@
     
     #define MAXCHARLEN 32768 //32K
     
    +// for server2008 when using function pow() then throws STATUS_ILLEGAL_INSTRUCTION
    +double pow(int base, short power, unsigned long *error)
    +{
    +	DWORD dwVersion = 0;
    +	DWORD dwBuild = 0;
    +
    +	dwVersion = GetVersion();
    +
    +	// Get the build number.
    +
    +	if (dwVersion < 0x80000000)
    +		dwBuild = (DWORD)(HIWORD(dwVersion));
    +
    +	double retValue = 1;
    --- End diff --
    
    The variable retValue could be 1 or the actual value or junk value depending upon whether
pow succeeded or not. So the caller is expected to test *error value returned first to determine
if the retValue is correct or not. If the *error  is not initialized for positive cases, 
the value stored in *error  could be undefined. In that case, the caller could be checking
the incorrect value of *error value.


---

Mime
View raw message