Oct 30, 2016

Using return statement in Pascal such as C language

C/C++ language allow us to retrieve the values of functions by using return keyword. See the following example:

int func () {
    return {values-here};
Objects Pascal (such as Free Pascal, Virtual Pascal) using variable result to retrieve the values of function. By using {$X+} directive:

function func: integer;
    result:= {values-here};
Return statement isn't a good coding practice. Using return statement could cause multiple ret instruction to be issued and it causes bigger code.

No comments:

Post a Comment