mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-05-28 08:20:40 +02:00
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:
parent
913a1bfd85
commit
ddf2839762
10
glib/docs.c
10
glib/docs.c
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user