2
$\begingroup$

Wordsense.eu gives a definition of epilogue as

  1. (computing) A component of a computer program that prepares the computer to return from a routine.

I’d like to know more & haven’t been able to successfully search for info. Could anyone point me to a source / share their knowledge?

$\endgroup$
1
9
$\begingroup$

It depends on context, languages, operating systems

In many languages, Prologues and Epilogues are the parts automatically added by compilers at the beginning and end of each function, for example adjusting stack pointers or copying parameters.

$\endgroup$
3
$\begingroup$

The popular x86 architecture has two instructions, ENTER and LEAVE, that are designed to be used as a prolog and epilog for functions. They adjust stack pointers. In practice they are not used, see this stackoverflow question.

The same architecture also has two pairs of instructions, PUSHA/POPA and their 32-bit analogs PUSHAD/POPAD, which could also form part of prologs and epilogs. They store and restore registers, though in practice they are not used, see this stackoverflow question.

For more on this, see also this question on stackoverflow.

Prologs and epilogs (sometimes called initialization and finalization) also appear in larger units, for example executables or the operating system. See for example this question on stackoverflow for some hints.

Finally, prologs and epilogs are also popular in object oriented programming, where they are known as constructors and destructors.

$\endgroup$
2
  • 1
    $\begingroup$ I agree with you up until the last paragraph. I see what you're going for, but I think it's a bit too much of a stretch. If you consider constructors and destructors to be prologs and epilogs, then any resource acquisition and release functions could be — e.g., fopen() and fclose() in C — which I think strays from the meaning of "preparing to enter or leave a routine". $\endgroup$ May 31 at 2:05
  • $\begingroup$ @ChrisBouchard: The point of RAII is that one should think about resource acquisition & release as "preparing to enter or leave a [section of the program]." Of course, not all languages support RAII (but the ones that do are better IMHO). $\endgroup$ May 31 at 6:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.