Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

-+ operator 1

Status
Not open for further replies.

BorlandDave

Programmer
Jun 13, 2005
86
GB
Is -+ a valid operator? I'm editing a program written by someone else and I have never come across this before. Could it be a typo? The instance is as follows:

if(var1 && -+var2){
//...
}

Thanks for any help.
 
Hmmm. I've never seen that before either. What are var1 and var2?


James P. Cottingham
-----------------------------------------
I'm number 1,229!
I'm number 1,229!
 
That muddies things a bit, too. I don't think -- or ++ work with booleans. It must be a typo.



James P. Cottingham
-----------------------------------------
I'm number 1,229!
I'm number 1,229!
 
Ok, thanks for that. I'll look into it a bit further and see if I can work out what is going on!
 
-+var2 is the same as -(+var2); they're both unary operators. But what the point of the expression is, I've no idea.
 
Right, so we're all agreed it must be a typo. I was getting worried for a minute :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top