Tcl_SetRecursionLimit(3tcl)

πŸ“¦
version 9.0.4 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ Tcl_SetRecursionLimit ✨

okay bestie, welcome to the Tcl Library Procedures corner of the man pages πŸ’… this one is Tcl_SetRecursionLimit(3tcl) and it's literally about how deep your interpreter is allowed to go before Tcl is like "girl. stop." πŸ›‘


🌸 NAME 🌸

Tcl_SetRecursionLimit β€” set maximum allowable nesting depth in interpreter πŸŒ€


πŸŽ€ SYNOPSIS πŸŽ€

#include <tcl.h>

Tcl_Size
Tcl_SetRecursionLimit(interp, depth)

πŸ’– ARGUMENTS πŸ’–

  • Tcl_Interp *interp (in) β€” the interpreter whose recursion limit you're setting, bestie. and no, it Must be greater than zero, so don't even try it with a null-ish nothing. πŸ™ˆ
  • Tcl_Size depth (in) β€” the new limit for nested calls to Tcl_Eval for interp. that's the number, the whole number, nothing but the number. πŸ”’

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea β˜• β€” 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 gets aborted with an error. no mercy, no vibes, just error. πŸ’€ and the default? the recursion limit is 1000. iconic number, honestly.

Tcl_SetRecursionLimit is your girl for changing the maximum allowable nesting depth for an interpreter. you hand it a depth argument, it specifies a new limit for interp, and it returns the old limit β€” like a little souvenir from before you changed everything. 🫢

and here's a cute trick: if you just wanna read the old limit without modifying it at all, invoke Tcl_SetRecursionLimit with depth equal to 0. peek only, no touch. πŸ‘€

🚨 okay important warning time, no cap: 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 your application. so 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. the drama. 😭 if that happens, see if there is a mechanism in your system for increasing the maximum size of the C stack. go fix it, bestie, you got this. πŸ’ͺ

πŸ‘‘ KEYWORDS πŸ‘‘

nesting depth, recursion 🌈


and that's the whole page, fr fr. this was the Tcl library procedures manual, version 7.0, dated 7.0, filed under Tcl_SetRecursionLimit(3tcl) β€” mwah, go forth and recurse responsibly πŸ’œβœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from