Clarify docs for common macros

Numeric macros such as MIN(), MAX(), etc. should not be handed
arguments with side-effects, such as i++, since we can't guarantee
that the values are only evaluated once.
This commit is contained in:
Matthias Clasen 2025-03-17 21:23:52 -04:00
parent 913a1bfd85
commit ddf2839762

View File

@ -946,6 +946,8 @@
*
* Calculates the minimum of @a and @b.
*
* Note that it is an error to pass values with side-effects.
*
* Returns: the minimum of @a and @b.
*/
@ -956,6 +958,8 @@
*
* Calculates the maximum of @a and @b.
*
* Note that it is an error to pass values with side-effects.
*
* Returns: the maximum of @a and @b.
*/
@ -970,6 +974,8 @@
* - ABS(-10) is 10.
* - ABS(10) is also 10.
*
* Note that it is an error to pass values with side-effects.
*
* Returns: the absolute value of @a.
*/
@ -987,6 +993,8 @@
* - CLAMP(15, 5, 10) is 10.
* - CLAMP(20, 15, 25) is 20.
*
* Note that it is an error to pass values with side-effects.
*
* Returns: the value of @x clamped to the range between @low and @high
*/
@ -1005,6 +1013,8 @@
* - `G_APPROX_VALUE (n, 0.f, FLT_EPSILON)` evaluates to true if `n` is within
* the single precision floating point epsilon from zero
*
* Note that it is an error to pass values with side-effects.
*
* Returns: %TRUE if the two values are within the desired range
*
* Since: 2.58