We study the Hamiltonian formulation of fðRÞ theories of gravity both in metric and in Palatini formalism using their classical equivalence with Brans-Dicke theories with a nontrivial potential. The Palatini case, which corresponds to the ! ¼ À3=2 Brans-Dicke theory, requires special attention because of new constraints associated with the scalar field, which is nondynamical. We derive, compare, and discuss the constraints and evolution equations for the ! ¼ À3=2 and ! Þ À3=2 cases. Based on the properties of the constraint and evolution equations, we find that, contrary to certain claims in the literature, the Cauchy problem for the ! ¼ À3=2 case is well formulated and there is no reason to believe that it is not well posed in general.