4. For $x \in \mathbf{R}$, the function $f(x+2)+f(x-2)$ $=f(x)$, then it is a periodic function. The smallest positive period of such a function is ( ).
(A) 4
(B) 6
(C) 8
(D) 12
4.D.

Let $x-2$ replace $x$ in the equation, then we have
$$
f(x)+f(x-4)=f(x-2) \text {. }
$$

Thus, $f(x+2)=-f(x-4)$.
It follows that $f(x+6)=-f(x)$, hence $f(x+12)=f(x)$.