(I tried to seek the answer using Google and got mostly pages
in Chinese.)
If I can't get goto to work, I will use exceptions.
Thanks in advance.
Francis
> Could someone please tell me what this Delphi error message
> actually means?
IMO you missed to define the label (lbl:) somewhere in the subroutine.
DoDi
> Could someone please tell me what this Delphi error message
> actually means?
Well apparently, you declared it, and referenced it, but you didn't set
it.
Declare:
label x123;
Reference:
// code
goto x123;
// more code;
Set:
// code
x123:
// code you want to jump to
--
Rudy Velthuis http://rvelthuis.de
"I am become death, shatterer of worlds."
-- Robert J. Oppenheimer (1904-1967) (citing from the
Bhagavad Gita, after witnessing the world's first nuclear
explosion)
But I most certainly did! How odd!
I will try and isolate the problem by deleted intervening code
until it works.. or doesn't. I really want to get to the bottom
of this.
Francis
> > Well apparently, you declared it, and referenced it, but you didn't
> > set it.
> > [...]
> > Set:
> >
> > // code
> > x123:
> > // code you want to jump to
>
> But I most certainly did! How odd!
>
> I will try and isolate the problem by deleted intervening code
> until it works.. or doesn't. I really want to get to the bottom
> of this.
Is the label in the same procedure or function? It MUST be.
--
Rudy Velthuis http://rvelthuis.de
"One word sums up probably the responsibility of any Governor,
and that one word is 'to be prepared'." -- George W. Bush
I thought it was, but I was mistaken. In converting multiple instances
of:
if SomethingWentWrong then begin
TidyUp;
Exit;
end;
into
if SomethingWentWrong then
goto ErrorExit;
I left an 'end' statement in by mistake - so the compiler thought
the function had finished without the label being set. Mea culpa.
Of course, I should have heeded the messages *after* the first one.
I saw them but thought they referred to other errors and warnings
that I had half-expected to encounter.
Mismatched begin/end pairs do happen inadvertently, but usually I
spot them immediately. Not this time. :-/
This has got me wondering whether some form of function highlighting
might be a useful option in the editor - e.g. shading the background
subtly to indicate the extent of a function or procedure, or where
the compiler thinks they end. I guess a folding editor could do that
fairly naturally.
Anyway, sorry to have wasted your time on a trivial matter.
Francis
> Anyway, sorry to have wasted your time on a trivial matter.
Most errors or mistakes are because of trivial matters, so that is OK.
--
Rudy Velthuis http://rvelthuis.de
"UNIX is basically a simple operating system, but you have to be
a genius to understand the simplicity." -- Dennis Ritchie.