Troubleshooting
Problem
DXL encounters the following error when not equal operator is used with an integer variable and a referenced integer variable:
-R-W- DXL: <Line:3> Argument 2 (32 bit int) was passed with a 64 bit value
Symptom
Consider the following code:
void testCompare(int intA, int& intB)
{
if (intB != intA)
print "B not equal A (3)\n"
else
print "A equal B (3)\n"
}
int intA = 1
int intB = 5
testCompare(intA, intB)
DXL encounters an error when you have used not equal operator with an integer variable and a referenced integer variable.
Cause
DXL compares the address of the int and not the value because of the DXL parser architecture design limitation.
Resolving The Problem
DXL encounters an error for the following example:
void testOne(int intA, int &intB)
{
print "" (intB != intA) "\n"}
}
{
print "" (intB != intA) "\n"}
}
To fix this problem, do one of the following workarounds:
- Use the non-reference variable first in the comparison.
void testOne(int intA, int &intB)
{
print "" (intA != intB) "\n"}
} - Make a local copy of the referenced variable before doing the comparison.
void testOne(int intA, int &intB)
{
int intB_copy = intB
print "" (intB_copy != intA) "\n"}
} - Stop using the pass by reference.
void testOne(int intA, int intB)
{
print "" (intB != intA) "\n"}
}
Document Location
Worldwide
[{"Type":"MASTER","Line of Business":{"code":"LOB59","label":"Sustainability Software"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSKR2T","label":"IBM Engineering Requirements Management DOORS"},"ARM Category":[{"code":"a8m50000000L3D6AAK","label":"DOORS"}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"9.7.2"}]
Was this topic helpful?
Document Information
Modified date:
14 April 2023
UID
ibm16983140