|
-
April 27th, 2011, 05:51 PM
#1
Boolean expression evaluating to false, should be true.
Hello,
I am running into a very peculiar problem. Here's a code snippet:
Code:
for( int i = 0; ( ( mStageInstrCounter[WB_STAGE] <= mCodeList.size() ) || ( i < mCodeList.size() ) ); i++ )
{
//code here
}
mStageInstrCounter is a vector of 8 ints.
WB_STAGE is a constant equal to 7.
mCodeList.size() is equal to 3 (in my sample case).
Now, this part:
Code:
(mStageInstrCounter[WB_STAGE] <= mCodeList.size())
Keeps evaluating to false. I have run this thing through my debugger and mCodeList.size() is indeed 3. In addition mStageInstrCounter[WB_STAGE] is equal to -1 (it is what each of the values in the vector get initialized to. I am trying to figure out why this is the case.
It functions as expected if I create two new ints. Assign one the value of mStageInstrCounter[WB_STAGE] and another to hold mCodeList.size(). This seems like a hackish way of doing things here. Thanks for any explanation.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|