Sign in Join
Wiki copytemporary

Frame

A frame (frequently also referred to as block) is a language construct grouping a (possibly empty) sequence of statements (or instructions in the case of asm frames).

available types

All frames but repeat … until are terminated by the word end. Frame types are distinguished by their corresponding opening words.

style

Although not mandatory, it is customary to indent all code surrounded by frame markers by one level.

delphi
try
    openJar;
except
    throwATantrum;
end;

Some styles add another indentation level for nested or subordinate frame markers per se.

pascal
if apples = oranges then
  begin
    protest;
    halt(123);
  end;

As you can see from the examples above, it is customary to put frame delimiters isolated in their own line. Exempt of this guideline are of course frames accepting or requiring additional clauses to be syntactically complete:

pascal
repeat
    write('Enter a non-negative integer: ');
    readLn(i);
until i >= 0;
delphi
asm
    rdrand eax
    mov n, eax
END ['eax'];

technical background

Frames frequently, but not always, turn up to be (conditional) jmp targets. Some compile-time optimizations require code to be structured in a certain way, frames setting boundaries for that.


From the Free Pascal wiki, page "Frame", as it stood on 2021-02-06 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.