[fpc-devel]raise's exceptaddr
Michael.VanCanneyt at Wisa.be
Michael.VanCanneyt at Wisa.be
Thu May 16 20:23:43 CEST 2002
On Thu, 16 May 2002, Aleksey V. Vaneev wrote:
> 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.
OK, I see what you mean now, yes, in this case the code will be faster.
I'm not sure whether this is possible, this is something for Florian
Klaempfl to decide :/
Michael.
More information about the fpc-devel
mailing list