加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

在Delphi中,“ReturnAddress”是什么意思?

发布时间:2020-12-15 10:18:18 所属栏目:大数据 来源:网络整理
导读:浏览System.Zip(Delphi XE2)看看它是如何工作的,我发现这个功能: procedure VerifyWrite(Stream: TStream; var Buffer; Count: Integer);begin if Stream.Write(Buffer,Count) Count then raise EZipException.CreateRes(@SZipErrorWrite) at ReturnAddres
浏览System.Zip(Delphi XE2)看看它是如何工作的,我发现这个功能:
procedure VerifyWrite(Stream: TStream; var Buffer; Count: Integer);
begin
  if Stream.Write(Buffer,Count) <> Count then
    raise EZipException.CreateRes(@SZipErrorWrite) at ReturnAddress;
end;

这是在ReturnAddress部分,令我难以置信。

我不知道那是一个有效的关键字(语法荧光笔似乎也不认识它)。

根据IDE,它被声明为System.ReturnAddress,但是我只能在程序_HandleAnyException的(asm)代码中找到它被声明为一个标签。系统单元充满了对它的引用。

所以我想知道的是这样的:

什么是ReturnAddress?
>什么是提升Exception.Create …在ReturnAddress?

奖励积分,如果你能给出一个真实世界的例子,说明这将是一个有用的结构,或者你可以建议不要使用它。

解决方法

ReturnAddress是VerifyWrite在完成时返回的地址。

提升异常。在ReturnAddress中创建…意味着当显示异常对话框时,它会将异常的地址指示为ReturnAddress。换句话说,异常消息将读取Exception< whatever>在< ReturnAddress&gt ;:<异常消息&gt ;. 这是Delphi 7的帮助文件的摘录。它几乎和the online version相同。

To raise an exception object,use an instance of the exception
class with a raise statement. For example,

06000

In general,the form of a raise statement is

06001

where object and at address are both optional; see
Re-raising exceptions. When an address is specified,
it can be any expression that evaluates to a pointer
type,but is usually a pointer to a procedure or function.
For example:

06002

Use this option to raise the exception from an earlier point
in the stack than the one where the error actually occurred.

注意最后一句话。关于使用< address&gt

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读