ETrue Comparison error
| Fri, 2007-09-14 16:30 | |
|
Hi Guyes , TBool iFlag = EFalse; if i compile the above code i dnt get any error , Undefined symbol: 'int operator==(int, enum TTrue) (??8@YAHHW4TTrue@@@Z)' I m currently using Carbide.c++ express edition v1.2.2 Build 5 I Know there is alternate solution available for this code , like ...if(iFlag) |
|






Forum posts: 2006
You should not test boolean against ETrue or EFalse but use the following:
TBool iFlag = EFalse; if(iFlag) { .... Do something if iFlag is ETrue ... } if(!iFlag) { .... Do something if iFlag is EFalse... }Eric Bustarret
NewLC Founder & CEO / Professional Symbian OS Consultant
Forum posts: 22
Thnxs 4 ur Immediate reaply eric
But i want to figure out what problem in my code
Sorry ........ I m novice
Forum posts: 1241
TBool is defined in E32DEF.H as
typedef int TBool;but ETrue and EFalse, a bit strangely, in E32STD.H as
enum TFalse {EFalse=FALSE};enum TTrue {ETrue=TRUE};
Now, if you want to compare with == an int and a value of an enumeration type, a special operator overload must be present. It isn't, that's why your code does not compile.
René Brunner
Forum posts: 364
I think the it might be designed deliberatly that it generates a compilation error
Forum posts: 22
Thanks , 4 Ur replay
Mr René Brunner
I m agree with U , Opertaor (==)is not defined .
Mr Buttington
" I think the it might be designed deliberatly that it generates a compilation error "
I m also agree with Ur comment ,