diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2021-03-08 12:19:11 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2021-03-08 12:19:11 +0000 |
commit | 8602a4fb0b20a882ce00c7b148b04d54b14521fc (patch) | |
tree | c8f99f9cca7cca7e1fb128ae6fc4ef1681b8bcb0 | |
parent | dacd9a5c131a56fcc619fa1b70392e90035a1a06 (diff) | |
download | mpfr-8602a4fb0b20a882ce00c7b148b04d54b14521fc.tar.gz |
Clarification about the custom interface and macros.
* doc/mpfr.texi: added some text in Section "Custom Interface".
* src/mpfr.h: replaced the remaining FIXME by another comment.
git-svn-id: https://scm.gforge.inria.fr/anonscm/svn/mpfr/trunk@14462 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r-- | doc/mpfr.texi | 6 | ||||
-rw-r--r-- | src/mpfr.h | 5 |
2 files changed, 9 insertions, 2 deletions
diff --git a/doc/mpfr.texi b/doc/mpfr.texi index 424997714..2622b1c4b 100644 --- a/doc/mpfr.texi +++ b/doc/mpfr.texi @@ -3902,6 +3902,12 @@ to the application. Each function in this interface is also implemented as a macro for efficiency reasons: for example @code{mpfr_custom_init (s, p)} uses the macro, while @code{(mpfr_custom_init) (s, p)} uses the function. +Note that the macro may evaluate arguments multiple times (or none). +Moreover, macros implementing functions with the @code{void} return type +may not be used in contexts where an expression is expected, e.g., inside +@code{for(...)} or before a comma operator. +@c These limitations with macros cannot be avoided in a C90 compatible way. +@c In the future, inline functions could be used. Note 1: MPFR functions may still initialize temporary floating-point numbers using @code{mpfr_init} and similar functions. See Custom Allocation (GNU MP)@. diff --git a/src/mpfr.h b/src/mpfr.h index 2f4b8435c..1f2a01915 100644 --- a/src/mpfr.h +++ b/src/mpfr.h @@ -872,8 +872,9 @@ __MPFR_DECLSPEC int mpfr_total_order_p (mpfr_srcptr, mpfr_srcptr); /* In the implementation of these macros, we need to make sure that the arguments are evaluated one time exactly and that type conversion is done as it would be with a function. Tests should be added to ensure - that. */ -/* FIXME: the mpfr_custom_* macros are currently buggy. */ + that. + Note that the macros for the custom interface are not concerned; the + MPFR manual has been clarified. */ /* Prevent x from being used as an lvalue. Thanks to Wojtek Lerch and Tim Rentsch for the idea. */ |