C++ assign and check in one line?

  assign, c++

I have a function my_fun which returns random number.

How can I do declaration and value check in one line?

int x;
  1. if (x= my_fun()<0)

  2. if ((x= my_fun())<0)

  3. if ((x= my_fun()<0)) // this is what my IDE suggests but looks strange since those extra braces don't help at all.

Source: Windows Questions C++