In this paper we give an exhaustive generation algorithm for the class of m-compositions of integers with fixed m. Moreover we define a Gray code to list these combinatorial objects according to a particular order. Finally, we define m-partitions, which are an m-dimensional generalization of integer partitions, and an exhaustive generation algorithm for m-partitions, based on the same ideas used for m-compositions, is given.