我正在尝试更多地了解编程语言。我正在使用以下代码使用递归。我让它运行,直到抛出堆栈异常。在不捕获错误和/或防御性编码以防止这种深度递归的情况下: - 当此例程运行时,我是否可以进行调整以释放任何堆栈空间?
Module Module1 Private var As Integer = 1
Sub Main()
Take1(var)
End Sub
Public Function Take1(p1 As Integer) As Integer
p1 = p1 + 1
Console.Write(p1 & vbCrLf)
Take1 = Nothing
Call Take2(p1)
End Function
Public Function Take2(p1 As Integer) As Integer
p1 = p1 + 1
Console.Write(p1 & vbCrLf)
Take2 = Nothing
Call Take1(p1)
End Function
端模块