FLINT3.7.0-dev

GR_TMP_INIT, GR_TMP_INIT2, GR_TMP_INIT3, GR_TMP_INIT4, GR_TMP_INIT5, GR_TMP_CLEAR, GR_TMP_CLEAR2, GR_TMP_CLEAR3, GR_TMP_CLEAR4, GR_TMP_CLEAR5

Synopsis#include <flint/gr.h>
GR_TMP_INIT(x1, ctx)source
GR_TMP_INIT2(x1, x2, ctx)source
GR_TMP_INIT3(x1, x2, x3, ctx)source
GR_TMP_INIT4(x1, x2, x3, x4, ctx)source
GR_TMP_INIT5(x1, x2, x3, x4, x5, ctx)source
GR_TMP_CLEAR(x1, ctx)source
GR_TMP_CLEAR2(x1, x2, ctx)source
GR_TMP_CLEAR3(x1, x2, x3, ctx)source
GR_TMP_CLEAR4(x1, x2, x3, x4, ctx)source
GR_TMP_CLEAR5(x1, x2, x3, x4, x5, ctx)source

Allocate one to five temporary elements contiguously on the stack with alloca, initialised to zero, and assign their addresses to the gr_ptr variables x1, ...; the matching GR_TMP_CLEAR macro clears them. An INIT and a CLEAR macro must match exactly.

The memory is reclaimed only when the enclosing function returns, so these macros must not be used inside a loop: allocate before the loop, move the loop body to a separate function, or use the heap. Elements are expected to be small (a few kilobytes at most), which holds for all built-in rings.

Guides#

Cite this page

The FLINT team, “GR_TMP_INIT, GR_TMP_INIT2, GR_TMP_INIT3, GR_TMP_INIT4, GR_TMP_INIT5, GR_TMP_CLEAR, GR_TMP_CLEAR2, GR_TMP_CLEAR3, GR_TMP_CLEAR4, GR_TMP_CLEAR5 (gr.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/gr/GR_TMP_INIT.html (generated 2026-10-20).