Skip to content

Commit deb747e

Browse files
author
Aaron K. Johnson
committedMar 22, 2025·
Add stack depth arg validation for make_sb_tree example word
1 parent af8406e commit deb747e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed
 

‎examples/stern_brocot_tree.dc

+6-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,12 @@ lmake denominators !
4242
again
4343
;
4444

45-
: make_sb_tree { loops n1 d1 n2 d2 }
45+
: make_sb_tree
46+
depth 5 < if
47+
"make_sb_tree: stack underflow; need <loops> <n1> <d1> <n2> <d2> on the stack!" print cr
48+
return
49+
endif
50+
{ loops n1 d1 n2 d2 }
4651
0 loops n1 d1 n2 d2 _make_sb_tree_real
4752
_show_sb_tree
4853
;

0 commit comments

Comments
 (0)
Please sign in to comment.