Bug #9126 2006-10-15 06:12
skisoccer13
comparing strings with elements of vectors
It seems that the following if statement causes my program to crash. Given that 'word' is a string, words is a vector of strings, and 'i' is a position in the vector.
if (word != words[i] ) {
...
}
If I change the code to read:
if (word != (words[i])) {
...
}
I no longer crash.
- Category
- Compiler
- Group
- Status
- Closed
- Close date
- 2006-10-18 00:00
- Assigned to
History
Also, using
if (words[i] != word) {
...
}
works because the vector is executed first. It seems like within conditional statements if the vector is not first and/or not enclosed by parentheses then it doesn't execute in the proper order.
Sorry but it has nothing to do with Code::Blocks. Please report it to the developers of the compiler you're using.
Sorry but it has nothing to do with Code::Blocks. Please report it to the developers of the compiler you're using.