say you want to comment out an entire function in c++ in emacs. then you do the following
any where in the function code hit C-M-a this will take you to the beginning of function defination.
next you hit M-space this will begin the selection range.
to go to the end of the function definition hit C-M-e
wallah the entire code block of the function definition is now selected. Hit M-; to comment it out