There are various measurement units that one can use (such as pt, mm, in, em, ex etc.) for specifying lengths and heights. For font-based units (em and ex) the actual spacing will vary slightly depending on the font. For the other types of units the spacing is fixed at the given measurement.
Is it better to prefer some of these units over others in certain situations? For example, is the "em" unit better than a fixed measurement when specifying lengths for indenting text eg. when setting xleftmargin, and xrightmargin in the listings package. When would you use the "ex" unit for specifying heights? I imagine fixed units should always be used when setting page margins.
So, I guess what I am asking is, what are the guidelines for deciding which measurement units to use?