What does `at ReturnAddress` mean in Delphi?

ReturnAddress is the address to which VerifyWrite would have returned when finished.

Raise Exception.Create... at ReturnAddress means that when the exception dialog is displayed, it would indicate the address of the exception as being at ReturnAddress. In other words, the exception message would read Exception <whatever> raised at <ReturnAddress>: <Exception Message>.

Here is an excerpt from the help file for Delphi 7. It’s nearly the same as the online version.

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

raise EMathError.Create;

In general, the form of a raise statement is

raise object at address

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:

raise Exception.Create('Missing parameter') at @MyFunction;

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

Note the last sentence in particular. It’s pretty specific about the use of at <address>.

Leave a Comment

tech