[fpc-devel]raise's exceptaddr

Aleksey V. Vaneev picoder at sbis.komi.ru
Thu May 16 17:28:18 CEST 2002


Hello,

> The frame will always be created. As soon as ansistrings is used
> in a procedure, an exception frame is created in a procedure -
> always. Even is no raise statement is present (an exception could
> e.g. be raised in a called procedure).
> 
> Michael.

I think you have not got the idea.

I mean, if I write something like this:

resourcestring
  ErrMsg = 'aaabbbccc';

procedure Test123;
begin
     if (not Success) then
       raise Exception.create (ErrMsg);

    ...do something a little...
end;

Stackframe will be created for the whole Test123 and its overhead will be
applied to "...do something a little..." in all the cases.

But if I write in this way:

procedure Test123;

  procedure doraise;
  begin
    raise Exception.create (ErrMsg);
  end;
  
begin
     if (not Success) then
       doraise;
       
    ...do something a little...
end;

Overhead is issued ONLY if Success = False. In all other cases "...do
something a little..." executes without ANY unnecessary overhead.

Best regards,
 Aleksey                          mailto:picoder at sbis.komi.ru






More information about the fpc-devel mailing list