This line of code just passed compilation

 
   if( map.drawRange((int)(startX+0.5), (int)(startY+0.5), (int)(endX+0.5), (int)(endY+0.5)), !max);


Now what I want to point out is that the
First: drawRange declaration is this
 
   bool drawRange(int x0, int y0, int x1, int y1, bool max = false);


second that if above was not supposed to be there, its part of code that I thought I erased, after much debugging, I find that if and was amazed that it compiled through. Maybe there is something new I can learn, this if is recieving two bools! what does that mean?
I don't understand what you mean.

It does not execute anything anyway you have a ; at the end of it.

this is what you have.

1
2
3
4
5

if(true, false);
{
//even with out the semicolon it would not execute this code in here
}
exactly what I'm asking, since when can an "if" take two bools? and what does that mean?
See http://www.cplusplus.com/doc/tutorial/operators/ and scroll down to comma operator.

In that if statement only the last condition is used so if(false, true) would evaluate as true.
hmmm I never knew that, I wonder how can I use it? seems redundant since I never really needed it, but I love writing non comprehendable code :)
I only use it in a case that never comes up:

delete p, p = nullptr;

I always use it in this case - just know that this case never comes up (since you should never be managing memory yourself).
¿but what advantages do you have over using a semicolon?
Automatic reformatting tools won't split it onto separate lines.
Topic archived. No new replies allowed.