As you you can see in the following image, a right angle has some space to side BC.
How can I fix it and is there any better way to add an right angle?

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[fill=gray!10] (0, 4) coordinate (A)
-- node[above=4pt] {$4cm$} (3,4) coordinate (C)
-- node[right] {$8cm$} (3,0) coordinate (B)
-- node[left] {$xcm$} (0, 4);
\draw (2.6,4) -- ++(0,-10pt) -- ++(10pt,0);
\node at (A)[anchor=east] {$A$};
\node at (B)[anchor=north] {$B$};
\node at (C)[anchor=south] {$C$};
\end{tikzpicture}
\end{document}



angleslibrary, it is possible to use a small trick as per How do I draw a little red square to label my right triangle? – Claudio Fiandrino May 06 '14 at 06:58