| Q D E V _ H L P _ N E G ( )
| | | | | SOURCE: qdev_macros.txt 1.16 (12/09/2014) English INDEP - PUBLIC
----------------------------------------------------------------------------
NAME
QDEV_HLP_NEG() - Negativises the value given so it is
always on minus.
SYNOPSIS
neg = QDEV_HLP_NEG(a);
[LONG] QDEV_HLP_NEG([LONG]);
FUNCTION
This macro allows to turn possibly positive value into
a negative one.
INPUTS
a - Value of any type that can hold an integer.
RETURNS
Returns a if it is already negative or its negativised
eqiuvalent.
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_MAX(), QDEV_HLP_ABS()
EXAMPLE
#include <qdev.h>
...
LONG x = 6;
LONG z;
/*
* Example of the right usage, so no side effects will
* occurr.
*/
z = QDEV_HLP_NEG((x + 1));
/*
* Example of side effect statement which can turn the
* code into bad state.
*/
z = QDEV_HLP_NEG(x++);
...
BUGS
None known.
----------------------------------------------------------------------------
| |
| |