| Q D E V _ H L P _ M A X ( )
| | | | | SOURCE: qdev_macros.txt 1.16 (12/09/2014) English INDEP - PUBLIC
----------------------------------------------------------------------------
NAME
QDEV_HLP_MAX() - Picks the highest from given values.
SYNOPSIS
c = QDEV_HLP_MAX(a, b);
[LONG] QDEV_HLP_MAX([LONG], [LONG]);
FUNCTION
This macro allows to select the highest possible value
out of two values as passed in.
INPUTS
a - First value of any type that can hold an integer.
b - Second value of any type that can hold an integer.
RETURNS
Returns a or b depending on what is greater than the
other argument.
BASES
None.
NOTES
This macro can cause side effects, due to multiple arg.
evaluation! Make sure that what you pass are just the
arguments or constants or non-permanent statements.
SEE ALSO
QDEV_HLP_MIN(), QDEV_HLP_ABS(),
QDEV_HLP_NEG(), QDEV_HLP_FLIP()
EXAMPLE
#include <qdev.h>
...
LONG x = 6;
LONG y = 3;
LONG z;
/*
* Example of the right usage, so no side effects will
* occurr.
*/
z = QDEV_HLP_MAX((x - 1), y);
/*
* Example of side effect statement which can turn the
* code into bad state.
*/
z = QDEV_HLP_MAX(x--, y);
...
BUGS
None known.
----------------------------------------------------------------------------
| |
| |