You're asking when $$\int\limits_E f(x)dx$$ exists, where $E$ is some subset of the real line. This depends on your definition of integral. For example, take $f(x) = x$. One way to interpret $$\int_{-\infty}^{\infty} xdx$$ is as $$\lim\limits_{a \to \infty} \int_{-a}^a xdx$$ and this is clearly $0$. But there are other ways to interpret this integral and have it not converge. For example, if you let the positive bound to go infinity faster than the negative bound: $$\lim\limits_{a \to \infty} \int_{-a}^{2a} xdx$$ Actually, you can modify how the positive and negative bounds go to infinity and make that integral come out to whatever you want.
On the other hand, the Lebesgue integral $\int\limits_{(-\infty,\infty)} f(x)$ is defined quite differently and is not open to interpretation. It agrees with the Riemann integral on bounded intervals on most nice functions, but by definition $\int\limits_{(-\infty,\infty)} f$ exists if and only if when you only integrate on parts where $f$ is positive, and when you integrate on the parts where $f$ is negative, each of those converges. So $$\int\limits_{(-\infty,\infty)} xdx$$ is not defined as a Lebesgue integral.