Tcl_SetRecursionLimit(3)

πŸ“¦
version 9.0.3 Β· 3 versions
, in alpine 3.23, alpine 3.24, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

✨ NAME ✨

okay so bestie, welcome to the Tcl Library Procedures page for Tcl_SetRecursionLimit(3) β€” and it's literally all about setting the maximum allowable nesting depth in an interpreter. No cap. πŸ’…

Tcl_SetRecursionLimit β€” set maximum allowable nesting depth in interpreter


πŸŽ€ SYNOPSIS πŸŽ€

#include <tcl.h>

Tcl_Size
Tcl_SetRecursionLimit(interp, depth)

🌸 ARGUMENTS 🌸

  • Tcl_Interp *interp (in) β€” Interpreter whose recursion limit is to be set. Must be greater than zero. (Yes bestie, that's the rule, keep it in mind.)
  • Tcl_Size depth (in) β€” New limit for nested calls to Tcl_Eval for interp.

πŸ’– DESCRIPTION πŸ’–

At any given time Tcl enforces a limit on the number of recursive calls that may be active for Tcl_Eval and related procedures such as Tcl_EvalEx. Any call to Tcl_Eval that exceeds this depth is aborted with an error. By default the recursion limit is 1000. (So like, if you're going deeper than 1000 nested eval calls, Tcl is gonna shut that down, periodt. πŸ’€)

Tcl_SetRecursionLimit may be used to change the maximum allowable nesting depth for an interpreter. The depth argument specifies a new limit for interp, and Tcl_SetRecursionLimit returns the old limit. To read out the old limit without modifying it, invoke Tcl_SetRecursionLimit with depth equal to 0. (Sneaky lil read-only mode, iconic. ✨)

The Tcl_SetRecursionLimit only sets the size of the Tcl call stack: it cannot by itself prevent stack overflows on the C stack being used by the application. If your machine has a limit on the size of the C stack, you may get stack overflows before reaching the limit set by Tcl_SetRecursionLimit. If this happens, see if there is a mechanism in your system for increasing the maximum size of the C stack.

⚠️ so like, this function is not a magic C-stack shield, bestie. It only sets the size of the Tcl call stack. If your C stack has a limit, you can still overflow before hitting the Tcl limit. Check your system for a way to increase the max C stack size if that happens. 🫢

🌈 KEYWORDS 🌈

  • nesting depth
  • recursion

This page comes from Tcl 7.0, manual page Tcl_SetRecursionLimit(3) β€” the footer didn't include a date, so that's all she wrote. Byeee πŸ’…βœ¨

πŸ“¦ where this page comes from