Is the following going to work as expected on all platforms, sizes of int, etc? Or is there a more accepted way of doing it? (I made the following up.)
#define M
You can have a look at the class numeric_limits, included in the standard library.
numeric_limits
See here.