Original Post
Let's say I have a pointer i_p and I want to check if it's true, and if it is, evaluate a = f(i_p) and then check that a > and a < 5. Can I do: I know that I can accomplish this with a nested if but I'm already somewhat nested so I'd rather do this in one line. Is this more efficient that calling f twice? Does this code have well defined behaviour or am I exploiting an undefined feature? Thanks. [Edited by - daniel_i_l on April 1, 2009 6:34:50 PM]
int a;
if(i_p && a=f(i_p) && a>0 && a<5){
...
}