[mythtv] #define MAX
danielk at cuymedia.net
Mon Dec 12 08:19:07 EST 2005
On Mon, 2005-12-12 at 20:03 +1000, Paul Andreassen wrote:
> While writing a patch, I needed a max function and so wrote a simple marco as
> any c programmer does. Thinking about it further I realised that not only
> does MythTv use c++ but also QT, so surely there must already be a max
> function. Sure enough QT has one called QMAX defined in qglobal.h. Better
> yet c++ has one called max as a template in <limits>
> By greping MythTv source there are multiple definations. The worst is the
> #define max(a,b) ((a < b) ? b : a) which has to be fixed.
The ones in libmyth[soundtouch|samplerate] and libav[codec|util] need
to be left alone, we sync these with external libraries so we don't
want to have any changes that aren't needed in there.
> What is the correct max function to use?
I use std::max and std::min because they are type correct template
functions rather than macros.
More information about the mythtv-dev