Not the standard question on $\int^\infty_{-\infty}\frac{\sin x}{x}$ I am not asking how to calculate it. It is clear that can be done by integrating 
$\mathrm{e}^{iz}/z$ in complex plane. I am asking the following:


*

*Since $\,\mathrm{f}\left(z\right) = \sin\left(z\right)/z$ has a removable singularity at $z=0$ we may continue it to the whole complex plane by defining $\lim_{z \to 0}\mathrm{f}\left(z\right) = 1$. Then $\,\mathrm{f}$ is analytic and its integral over any closed curve $\gamma$ should be zero.

*So I was trying to verify it by choosing the standard $\gamma$ contour from residue calculation ( though no residue here ) in the upper half plane:


*

*$\gamma_R$ is a semicircle in the upper half plane on which clearly the integral of $\,\mathrm{f}\left(z\right)$ goes to zero as $R \to \infty$
( no problem there ).

*$\gamma_x$ the real line going from $-\infty$ to $+\infty$ and excluding an infinitesimal interval $\left[-\epsilon,+\epsilon\right]$ centered on the origin. The integral over $\gamma_x$ should give us twice the Sine integral which is $\pi$.

*$\gamma_{\epsilon}$- A small semicircle which may ( or may not ) exclude the origin. I expect the integral over $\gamma_{\epsilon}$ to go to
$-\pi$ as I take the limit $\epsilon\to 0$ so as to cancel the integral on $\gamma_x$ and give me zero total contour integral. But this does not happen. Since $\,\mathrm{f}\left(z\right)$ is regular at the origin the integral over that curve always goes to zero... So, what's happening ?. Am I wrong in assuming that the total contour integral should be zero .?
 A: No, the assumption of the contour integral is ok, but the integral over a half-circle in the upper (or the lower) half plane does not go to zero, because $\sin(z) = (e^{iz}-e^{-iz})/2i$ and one of the two exponentials is unbounded. That's probably why people usually takes only one of them to do this calculation.
A: Since $f(z)=\frac{\sin(z)}z$ is entire, then Cauchy's Integral Theorem guarantees that for any closed rectifiable path $C$ in the complex plane,  
$$\begin{align}
\oint_C \frac{\sin(z)}z\,dz&=0
\end{align}$$
In particular, if $C$ is the curve that is comprised of (1) the line segment from $-R$ to $R$, for any $R>0$, and (2) the semicircular arc $z=Re^{i\phi}$, for $0\le \phi\le\pi$, we have
$$\begin{align}
\oint_C \frac{\sin(z)}{z}\,dz&=\int_{-R}^R \frac{\sin(x)}x\,dx+\int_0^\pi \frac{\sin(Re^{i\phi})}{Re^{i\phi}}\,iRe^{i\phi}\,d\phi\\\\
&=\int_{-R}^R \frac{\sin(x)}x\,dx+i\int_0^\pi \sin(Re^{i\phi})\,d\phi \tag 1\\\\
&=0 \tag 2
\end{align}$$
Although we can let $R\to \infty$ in $(1)$, this process does not provide a way to evaluate either of the integrals on the right-hand side of $(1)$. We can deduce, however, that 
$$\int_{-\infty}^\infty \frac{\sin(x)}x\,dx=-\lim_{R\to \infty}\int_0^\pi \sinh(iRe^{i\phi})\,d\phi$$
