  We find a different approach to define convex functions in the sub-Riemannian
setting. A function on a sub-Riemannian manifold is nonholonomically geodesic
convex if its restriction to any nonholonomic (straightest) geodesic is convex.
In the case of Carnot groups, this definition coincides with that by
Danniell-Garofalo-Nieuhn (equivalent to that by Lu-Manfredi-Stroffolini).
Nonholonomic geodesics are defined using the horizontal connection. A new
distance corresponding to the horizontal connection has been introduced and
near regular points proven to be equivalent to the Carnot-Carath\`{e}odory
distance. Some basic properties of convex functions are studied. In particular
we prove that any nonholonomically geodesic convex function locally bounded
from above is locally Lipschitzian with respect to the Carnot-Carath\`{e}odory
distance.
