Is there a situation in delphi where a GOTO is the only solution? -


the goto statement taboo @ work.
following question born...

is there situation possible goto valid solution?

originally goto added pascal error handling, including inter procedural forms borland(/embarcadero) never implemented (example: gotoing inner procedure parent), borland never implemented other inner function functionality passing inner functions procedure-typed parameters.(*)

in way goto can considered precursor exceptions.

there still practical uses: last time checked, jumping out of nested if statement goto still faster in delphi letting code exit nested if naturally. optimizations these used in e.g. compression code, , other complex tree processing code nested loops or conditional statements.

such routines still use goto errorhandling, because faster. (exceptions not slow, border conditions inhibit optimizations).

one see part of plain pascal level of object pascal, c++ still allows plain c completely.

(of course, since optimized compression code in delphi delivered in .o form, hard find examples in delphi codebase. jpeg code has some, c translation)

(*) original pascal, , iirc turbo pascal doesn't allow prematurely exiting procedure exit. same continue , break.


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -