EStackOverflow 被弃用多久了?用什么来取代它?

发布于 2024-07-08 22:44:46 字数 669 浏览 7 评论 0原文

我注意到 SysUtils.pas 中定义的 EStackOverflow 在 Delphi 2009 中被标记为已弃用。我检查了一下,它在 2007 年也被标记为已弃用。我这里有一个 Delphi 7 安装磁盘,但我想我会问是否有人知道什么时候它已被弃用。

另外,有谁知道为什么,以及用什么代替它? 我编写了一个测试应用程序,该应用程序通过递归导致堆栈溢出,并且我仍然收到 EStackOverflow 异常,但如果我专门为其添加一个处理程序,那么我会得到

[DCC 警告] Unit57.pas(85):W1000 符号“EStackOverflow”已弃用

我知道 EStackOverflow 源自 EExternal,并且我可以捕获 EExternal 并检查 STATUS_STACK_OVERFLOW 的 ExceptionCode,但这似乎没有必要,因为它仍然会引发 EStackOverflow 异常。

这只是为了阻止我在自己的代码中抛出 EStackOverflow 吗?

(是的,我意识到在一个名为 StackOverflow 的网站上提出有关 EStackOverflow 的问题具有讽刺意味,是的,我是完全认真的。 )

I noticed that EStackOverflow, as defined in SysUtils.pas is marked as deprecated in Delphi 2009. I checked and it was also marked as deprecated in 2007. I have a Delphi 7 install disk here, but I thought I would ask if anyone knows when it was deprecated.

Additionally, does anyone know why, and what replaces it? I wrote a test application that causes a Stack Overflow through recursion, and I still get an EStackOverflow exception, but if I add a handler specifically for it then I get

[DCC Warning] Unit57.pas(85): W1000 Symbol 'EStackOverflow' is deprecated

I know that EStackOverflow descends from EExternal, and that I could trap EExternal and check ExceptionCode for STATUS_STACK_OVERFLOW, but that seems unnecessary since it still throws the EStackOverflow exception.

Is this just to discourage me from throwing an EStackOverflow in my own code?

(Yes, I realize the irony of asking a question about EStackOverflow on a website called StackOverflow, and yes I am completely serious.)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

千仐 2024-07-15 22:44:46

我这里没有 D5 可以说,但我几乎不记得 已弃用 指令
只出现在D6上。

至于 StackOverflow 异常,我认为它已被弃用,因为仅适用于 Delphi 运行时环境来引发它。

编辑:根据所有答案的汇总,当引入 Deprecated 关键字时,EStackOverflow 在 Delphi 6 中已被弃用。

I don't have D5 here to say, but I barely remember the deprecated directive
appeared only on D6.

As for StackOverflow exception, I think it's deprecated because is only for Delphi runtime environment to raise it.

EDIT: Based on the aggregate of all the answers, EStackOverflow was deprecated in Delphi 6 when the Deprecated keyword was introduced.

逆光飞翔i 2024-07-15 22:44:46

就像在 .NET 中一样,您无法真正捕获 StackOverflow 异常,那么您如何恢复? 如果您需要捕获一个,那么您的代码很可能是错误的:)

Just like in .NET, you cant really catch a StackOverflow exception, what do you recover to? Your code is most likely wrong if you need to catch one :)

娇女薄笑 2024-07-15 22:44:46

我刚刚检查了我的 Delphi 6,EStackOverflow 已被弃用。 我无法在这里访问旧版本的 Delphi。

我无法帮助您了解原因或可能的替代方案。

I just checked my Delphi 6, and EStackOverflow is already deprecated. I don't have access to older versions of Delphi here.

I can't help you with the why or the possible replacement.

旧瑾黎汐 2024-07-15 22:44:46

在 Delphi 5 中它还没有被弃用。

编辑:实际上,在 Delphi 5 中,“已弃用”不是保留字。

In Delphi 5 it's not yet deprecated.

edit: Actually, in Delphi 5, 'deprecated' is not a reserved word.

断桥再见 2024-07-15 22:44:46

这只是为了阻止我在自己的代码中抛出 EStackOverflow 吗?

更重要的是,我认为这意味着您不应该设计依赖于未来版本中抛出的代码。

Is this just to discourage me from throwing an EStackOverflow in my own code?

More importantly, I think this means you should not design code to depend on it being thrown in future versions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文