aboutsummaryrefslogtreecommitdiffstats
path: root/doc/gawktexi.in
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2022-02-25 12:30:16 +0200
committerArnold D. Robbins <arnold@skeeve.com>2022-02-25 12:30:16 +0200
commit8f166e9571804a61c33822722c334062e1e47c39 (patch)
treec51c778b74e676a5fec31e4191d22b81b20d74be /doc/gawktexi.in
parenteb2c6b89f4eeea5a8069ffd2800012e652e30475 (diff)
downloadegawk-8f166e9571804a61c33822722c334062e1e47c39.tar.gz
egawk-8f166e9571804a61c33822722c334062e1e47c39.tar.bz2
egawk-8f166e9571804a61c33822722c334062e1e47c39.zip
Update doc for change to extension management of GMP/MPFR values.
Diffstat (limited to 'doc/gawktexi.in')
-rw-r--r--doc/gawktexi.in12
1 files changed, 8 insertions, 4 deletions
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 2eb81be6..991136c3 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -35086,8 +35086,13 @@ p = NULL; @ii{now} q @ii{``owns'' it}
MPFR and GMP objects are indeed allocated on the stack or dynamically,
but the MPFR and GMP libraries treat these objects as values, the same way that
you would pass an @code{int} or a @code{double} by value. There is no
-way to ``transfer ownership'' of MPFR and GMP objects. Thus, code in
-an extension should look like this:
+way to ``transfer ownership'' of MPFR and GMP objects.
+
+The final results of an MPFR or GMP calculation should be passed back
+to @command{gawk}, by value, as you would a string or a @code{double}.
+@command{gawk} will take care of freeing the storage.
+
+Thus, code in an extension should look like this:
@example
mpz_t part1, part2, answer; @ii{declare local values}
@@ -35101,9 +35106,8 @@ make_number_mpz(answer, & result); @ii{set it with final GMP value}
mpz_clear(part1); @ii{release intermediate values}
mpz_clear(part2);
-mpz_clear(answer);
-return result;
+return result; @ii{value in @code{answer} managed by @code{gawk}}
@end example
@node Registration Functions