Clarification regarding indefinite integral $\int\sqrt{1+\cos 2x}\,\mathrm{d}x $ Most evaluations i have seen regarding evaluation of $\int\sqrt{1+\cos 2x}\,\mathrm{d}x$ go like:
$$\int\sqrt{1+\cos 2x}\,\mathrm{d}x=\int\sqrt{2\cos^2x}\,\mathrm{d}x=\sqrt{2} \int \cos x\,\mathrm{d}x=\sqrt{2}\sin x+c.$$
My question is: 
shouldn't the calculations respect both the interval of integration and the absolute value that arises? 
Starting with the existence part for sake of completeness, since all indefinite integrals are evaluated with respect to an interval, one could proceed as follows:
Let $I$ be an open interval. Since $\sqrt{1+\cos 2x}$ is continuous on $I$, primitive exists and:
$$\int\sqrt{1+\cos 2x}\,\mathrm{d}x=\int\sqrt{2\cos^2x}\,\mathrm{d}x=\sqrt{2} \int |\cos x|\,\mathrm{d}x$$
and regarding on the interval $I$ of integration we proceed as follows: if
$\cos x>0$ on $I$ then the integral equals $\sqrt{2}\sin x+c$ and if $\cos x<0$ on $I$ then the integral equals $-\sqrt{2} \sin x+c$. 
Of course, in that case we have an issue when $I$ is such that both $\cos x>0$ and $<0$ happen, for example $I=(0,\pi)...$ 
Thanks in advance for this clarification.

Edit. Certainly this may apply to easier cases, such as $\displaystyle \int |x|\,\mathrm{d}x.$
 A: You might say it is $$\sqrt2\text{sign}(\cos x)\sin x+c(x)$$
where $c(x)$ is a piecewise constant function which jumps by $2\sqrt2$ whenever $\cos x=0$ to make sure the integral is continuous.
A: 
As seen in the graph, the integrand $g(x) = \sqrt{1+\cos 2x}$ is repeating and strictly positive. Though continuous, its derivative is not. Thus, $g(x)$ is a positive periodic function and only piece-wise differentiable.
Normally, its indefinite integral can be expressed as,
$$\int\sqrt{1+\cos 2x}\>dx=\sqrt{1+\cos 2x}\>\tan(x)+C$$
which is valid for any individual intervals, either $\cos x\ge 0$ or $\cos x<0$. However, the primitive can not be applied across intervals separated by the non-differentiable points $\frac\pi2 + n\pi$, because it is discontinuous at those points. For the primitive to be valid over all intervals, it has to be continuous and strictly increasing, as expected from the positivity of $g(x)$. 
The primitive valid across all $x$ can nonetheless be derived by taking into account of the periodicity of $g(x)$ and expressed as follows,
$$I(x)=\int\sqrt{1+\cos 2x}\>dx=2\sqrt2 \left[\frac x\pi+\frac12\right]+\sqrt{1+\cos 2x}\>\tan(x)+C$$
where $[x]$ denotes the integer function of $x$. Effectively, it assures the continuity and increasing monotonicity of $I(x)$, as seen in the graph below. As a result, the integral $I(x)$ is applicable to any integration intervals, for instance, the definite integral,
$$\int_0^8 \sqrt{1+\cos 2x}\>dx=I(x)|_{0}^{8}=\sqrt2(6-\sin8) $$

A: Sorry I can't comment yet, but maybe this helps understanding the $c(x)$ in Empy2's answer:
$a\in\mathbb{R},a>0$ and let $a_0\in\mathbb{R}$ be the greatest number less than $a$ with $\cos(a_0)=0$
$$\int_0^a\sqrt{1+\cos(2x)}dx$$
$$=\sqrt{2}[\int_0^\frac{\pi}{2}|\cos(x)| dx+\int_\frac{\pi}{2}^\frac{3\pi}{2}|\cos(x)|dx+\dots+\int_{a_0}^a|\cos(x)|dx]$$
$$=\sqrt{2}[1+2+2+\dots+sign(a)(\sin(a)-\sin(a_0))]$$
Since $\sqrt{1+\cos(2x)}$ is even you can show something similar for $a<0$
