530:, for example, the branch instructions BAL or BALR, designed for procedure calling, would save the return address in a processor register specified in the instruction, by convention register 14. To return, the subroutine had only to execute an indirect branch instruction (BR) through that register. If the subroutine needed that register for some other purpose (such as calling another subroutine), it would save the register's contents to a private memory location or a register
636:(namely, which have been called but haven't returned yet). Because of the ways in which programs were usually assembled from libraries, it was (and still is) not uncommon to find programs that include thousands of functions, of which only a handful are active at any given moment. For such programs, the call stack mechanism could save significant amounts of memory. Indeed, the call stack mechanism can be viewed as the earliest and simplest method for
1430:– allow multiple callables with the same name in the same scope, but operating on different types of input. Consider the square root function applied to real number, complex number and matrix input. The algorithm for each type of input is different, and the return value may have a different type. By writing three separate callables with the same name. i.e.
337:...the structure of the machine need not be complicated one bit. It is possible, since all the logical characteristics essential to this procedure are available, to evolve a coding instruction for placing the subroutines in the memory at places known to the machine, and in such a way that they may easily be called into use.
1713:
BAL 14, SUBRTN01 go to a subroutine, storing return address in R14 B TABLE(15) use returned value in reg 15 to index the branch table, * branching to the appropriate branch instr. TABLE B OK return code =00 GOOD
627:
implementations, used two separate stacks, one mainly for control information (like return addresses and loop counters) and the other for data. The former was, or worked like, a call stack and was only indirectly accessible to the programmer through other language constructs while the latter was more
561:
Compilers for
Fortran and other languages could easily make use of these instructions when available. This approach supported multiple levels of calls; however, since the return address, parameters, and return values of a subroutine were assigned fixed memory locations, it did not allow for recursive
557:
The JSB instruction placed the address of the NEXT instruction (namely, BB) into the location specified as its operand (namely, MYSUB), and then branched to the NEXT location after that (namely, AA = MYSUB + 1). The subroutine could then return to the main program by executing the indirect jump JMP
1175:
is a useful means to simplify some complex algorithms and break down complex problems. Recursive languages provide a new copy of local variables on each call. If the programmer desires the recursive callable to use the same variables instead of using locals, they typically declare them in a shared
631:
When stack-based procedure calls were first introduced, an important motivation was to save precious memory. With this scheme, the compiler does not have to reserve separate space in memory for the private data (parameters, return address, and local variables) of each procedure. At any moment, the
340:
In other words, one can designate subroutine A as division and subroutine B as complex multiplication and subroutine C as the evaluation of a standard error of a sequence of numbers, and so on through the list of subroutines needed for a particular problem. ... All these subroutines will then be
298:
The idea of a subroutine was worked out after computing machines had already existed for some time. The arithmetic and conditional jump instructions were planned ahead of time and have changed relatively little, but the special instructions used for procedure calls have changed greatly over the
2713:
providing information about the argument, such as string lengths and array bounds. This allows the procedure to be more general and eliminates the need for the programmer to pass such information. By default PL/I passes arguments by reference. A (trivial) function to change the sign of each
469:. Each subroutine could then be provided by a separate piece of tape, loaded or spliced before or after the main program (or "mainline"); and the same subroutine tape could then be used by many different programs. A similar approach was used in computers that loaded program instructions from
619:
The call stack is usually implemented as a contiguous area of memory. It is an arbitrary design choice whether the bottom of the stack is the lowest or highest address within this area, so that the stack may grow forwards or backwards in memory; however, many architectures chose the latter.
541:, the JSB instruction would perform a similar task, except that the return address was stored in the memory location that was the target of the branch. Execution of the procedure would actually begin at the next memory location. In the HP 2100 assembly language, one would write, for example
1077:
In some languages, such as BASIC, a callable has different syntax (i.e. keyword) for a callable that returns a value vs. one that does not. In other languages, the syntax is the same regardless. In some of these languages an extra keyword is used to declare no return value; for example
506:
On those computers, instead of modifying the function's return jump, the calling program would store the return address in a variable so that when the function completed, it would execute an indirect jump that would direct execution to the location given by the predefined variable.
437:
In the very early assemblers, subroutine support was limited. Subroutines were not explicitly separated from each other or from the main program, and indeed the source code of a subroutine could be interspersed with that of other subprograms. Some assemblers would offer predefined
332:
In
January 1947 John Mauchly presented general notes at 'A Symposium of Large Scale Digital Calculating Machinery' under the joint sponsorship of Harvard University and the Bureau of Ordnance, United States Navy. Here he discusses serial and parallel operation suggesting
1129:, which means it cannot change the state of the program. Functions always return the same result for the same input. Such languages typically only support functions that return a value, since there is no value in a function that has neither return value nor side effect.
1690:
Languages that do not support exceptions can use the return value to indicate success or failure of a call. Another approach is to use a well-known location like a global variable for success indication. A callable writes the value and the caller reads it after a call.
1939:(i.e. most languages offer ways to obtain the call trace which includes the names of the involved functions and perhaps even more information such as file names and line numbers); by not decomposing the code into functions, debugging would be severely impaired
1191:
and modern languages, almost invariably use a call stack, usually supported by the instruction sets to provide an activation record for each call. That way, a nested call can modify its local variables without affecting any of the suspended calls variables.
461:
Even with this cumbersome approach, subroutines proved very useful. They allowed the use of the same code in many different programs. Memory was a very scarce resource on early computers, and subroutines allowed significant savings in the size of programs.
385:, have a single-instruction subroutine call that uses a dedicated hardware stack to store return addresses—such hardware supports only a few levels of subroutine nesting, but can support recursive subroutines. Machines before the mid-1960s—such as the
1643:
Multiple argument definitions may be specified for each entry. A call to "gen_name" will result in a call to "name" when the argument is FIXED BINARY, "flame" when FLOAT", etc. If the argument matches none of the choices "pathname" will be called.
1317:
did not initially support recursion because only one set of variables and return address were allocated for each callable. Early computer instruction sets made storing return addresses and variables on a stack difficult. Machines with
1801:
code of the caller more effectively by taking into account the context and arguments at that call. Inlining, however, usually increases the compiled code size, except when only called once or the body is very short, like one line.
3832:
We could supply our assembling clerk with copies of the source code for all of our useful subroutines and then when presenting him with a mainline program for assembly, tell him which subroutines will be called in the mainline
1830:. For code compiled by the same or a compatible compiler, functions can be compiled separately from the programs that call them. The instruction sequences corresponding to call and return statements are called the procedure's
670:
One disadvantage of the call stack mechanism is the increased cost of a procedure call and its matching return. The extra cost includes incrementing and decrementing the stack pointer (and, in some architectures, checking for
1769:
cannot be called only once with its value used two times since the two calls may return different results. Moreover, in the few languages which define the order of evaluation of the division operator's operands, the value of
1453:. Often the compiler selects the overload to call based on the type of the input arguments or it fails if the input arguments do not select an overload. Older and weakly-typed languages generally do not support overloading.
405:
had a subroutine call instruction that placed the saved instruction counter value into a general-purpose register; this can be used to support arbitrarily deep subroutine nesting and recursive subroutines. The
Burroughs
2723:/* first array bounds from -5 to +10 and 3 to 9 */ declare array1 (-5:10, 3:9)float; /* second array bounds from 1 to 16 and 1 to 16 */ declare array2 (16,16) float; call change_sign(array1); call change_sign(array2);
1082:
in C, C++ and C#. In some languages, such as Python, the difference is whether the body contains a return statement with a value, and a particular callable may return with or without a value based on control flow.
1782:. So, while this optimization is safe in a purely functional programming language, a compiler for an language not limited to functional typically assumes the worst case, that every callable may have side effects.
686:, which return without making any procedure calls themselves. To reduce that overhead, many modern compilers try to delay the use of a call stack until it is really needed. For example, the call of a procedure
675:), and accessing the local variables and parameters by frame-relative addresses, instead of absolute addresses. The cost may be realized in increased execution time, or increased processor complexity, or both.
714:
In general, a callable unit is a list of instructions that, starting at the first instruction, executes sequentially except as directed via its internal logic. It can be invoked (called) many times during the
1993:
Some programmers suggest that a callable should perform exactly one task, and if it performs more than one task, it should be split up into multiple callables. They argue that callables are key components in
2038:) that orders the lines for execution, provides no separation of the code that is callable, no mechanism for passing arguments or to return a value and all variables are global. It provides the command
2739:
denotes the start of a function definition. The statements of the function body follow as indented on subsequent lines and end at the line that is indented the same as the first line or end of file.
90:
and to assign the chunks meaningful names (unless they are anonymous). Judicious application can reduce the cost of developing and maintaining software, while increasing its quality and reliability.
1434:, the resulting code may be easier to write and to maintain since each one has a name that is relatively easy to understand and to remember instead of giving longer and more complicated names like
401:
which saved the instruction counter in the first memory location of the called subroutine. This allows arbitrarily deep levels of subroutine nesting but does not support recursive subroutines. The
2691:
This function requires C++ – would not compile as C. It has the same behavior as the preceding example but passes the actual parameter by reference rather than passing its address. A call such as
442:
to generate the call and return sequences. By the 1960s, assemblers usually had much more sophisticated support for both inline and separately assembled subroutines that could be linked together.
1049:
Like a macro – replace the parameters with the unevaluated argument expressions, then evaluate the argument in the context of the caller every time that the callable uses the parameter
417:(1964) is one of the first accumulator-based machines to have a subroutine call instruction that saved the return address in a stack addressed by an accumulator or index register. The later
2351:
copies the reference; not the state of the object. The called procedure can modify the state of the object via its methods yet cannot modify the object reference of the actual parameter.
1664:
is a callable plus values of some of its variables captured from the environment in which it was created. Closures were a notable feature of the Lisp programming language, introduced by
1793:
eliminates calls for particular callables. The compiler replaces each call with the compiled code of the callable. Not only does this avoid the call overhead, but it also allows the
601:, at the top of the stack; when the procedure returns, its stack frame is deleted from the stack, and its space may be used for other procedure calls. Each stack frame contains the
86:
Callable units provide a powerful programming tool. The primary purpose is to allow for the decomposition of a large and/or complicated problem into chunks that have relatively low
690:
may store the return address and parameters of the called procedure in certain processor registers, and transfer control to the procedure's body by a simple jump. If the procedure
109:. There is a callable unit in the source code and an associated one in the machine code, but they are different kinds of callable units – with different implications and features.
307:, did not have a single subroutine call instruction. Subroutines could be implemented, but they required programmers to use the call sequence—a series of instructions—at each
577:
are not allowed for natural recalculation order, this allows a tree walk without reserving space for a stack in memory, which was very limited on small computers such as the
1687:
Most modern languages support exceptions which allows for exceptional control flow that pops the call stack until an exception handler is found to handle the condition.
3383:
Callable unit: (Of a software program or logical design) Function, method, operation, subroutine, procedure, or analogous structural unit that appears within a module.
3568:
Report by Dr. A.M. Turing on proposals for the development of an
Automatic Computing Engine (ACE): Submitted to the Executive Committee of the NPL in February 1946
1714:} B BAD return code =04 Invalid input } Branch table B ERROR return code =08 Unexpected condition }
1774:
must be fetched again before the second call, since the first call may have changed it. Determining whether a callable has a side effect is difficult – indeed,
553:
MYSUB NOP (Storage for MYSUB's return address.) AA ... (Start of MYSUB's body.) ... JMP MYSUB,I (Returns to the calling program.)
1761:
Some optimizations for minimizing call overhead may seem straight forward, but cannot be used if the callable has side effects. For example, in the expression
4100:
2013:
is generally deemed unwise, because it adds coupling between all callables that use the global variables. If such coupling is not necessary, they advise to
1380:, support declaring and defining a function inside, e.g., a function body, such that the name of the inner is only visible within the body of the outer.
264:
3275:
1702:
index into a branch table often located immediately after the call instruction to avoid extra conditional tests, further improving efficiency. In the
1932:
function name serves to describe the block of code. This makes the calling code concise and readable even if the function is not meant to be reused.
1698:, where return code was expected from a subroutine, the return value was often designed to be a multiple of 4—so that it could be used as a direct
356:
computer she was programming during World War II. She and the other ENIAC programmers used the subroutines to help calculate missile trajectories.
151:
have essentially the same meaning but describe a hierarchical relationship, much like how a subdirectory is structurally subordinate to its parent
3670:
3320:
2503:
to indicate that it does not return a value. This is followed by the function name, formal arguments in parentheses, and body lines in braces.
4001:
3856:
3471:
2800:
The first function returns greeting text that includes the name passed by the caller. The second function calls the first and is called like
637:
569:, in the early 1980s, to discover the recalculation dependencies in a spreadsheet. Namely, a location was reserved in each cell to store the
1388:
If a callable can be executed properly even when another execution of the same callable is already in progress, that callable is said to be
4114:
3623:
616:(VLIW) architectures), but many traditional machines designed since the late 1960s have included special instructions for that purpose.
3487:
1866:
or provides in a way other than for other functions. A built-in function does not need to be defined like other functions since it is
1665:
3723:
2645:
where the ampersand (&) tells the compiler to pass the address of a variable. Giving v is 5 before the call, it will be 7 after.
4140:
3965:
3818:
3589:
3432:
3407:
609:
2637:
This function has a side-effect – modifies the value passed by address to the input value plus 2. It could be called for variable
2208:
keyword denotes the start of a subroutine and is followed by a name identifier. Subsequent lines are the body which ends with the
735:
of callable units evolved over time and varies by context. This section describes features of the various common implementations.
4166:
2018:
1892:
477:
originally meant a library, in the literal sense, which kept indexed collections of tapes or decks of cards for collective use.
341:
stored in the machine, and all one needs to do is make a brief reference to them by number, as they are indicated in the coding.
4210:
2347:
does not. For an object, semantics can confuse programmers since an object is always treated as a reference. Passing an object
2188:
This code repeatedly asks the user to enter a number and reports the square root of the value. Lines 100-130 are the callable.
702:, it will then use the call stack to save the contents of any registers (such as the return address) that will be needed after
605:
of the corresponding call, which typically includes the procedure's parameters and internal variables, and the return address.
3994:
Adventures
Between Lower Bounds and Higher Altitudes: Essays Dedicated to Juraj HromkoviÄŤ on the Occasion of His 60th Birthday
1929:
2845:
1126:
1122:
1092:
890:
744:
218:
429:(1976) lines followed suit; this feature also supports both arbitrarily deep subroutine nesting and recursive subroutines.
2732:
1405:
1377:
1369:
846:
227:
3269:
1009:, such as Algol 68, Pascal, Delphi, Simula, CPL, PL/M, Modula, Oberon, Ada, and many others including C++, Fortran, PL/I
3701:
2511:
1681:
1200:
1053:
1036:
948:
925:
834:
644:
624:
124:
The term used tends to reflect the context in which it is used – usually based on the language being used. For example:
3263:
894:
222:
214:
1412:
was a slightly less restrictive, but similar, requirement for application programs that were shared by many threads.
1637:
attribute to define a generic name for a set of entry references called with different types of arguments. Example:
1660:
1653:
1365:
1156:
854:
613:
288:
190:
3613:(NB. Presented on 1946-03-19 before the Executive Committee of the National Physical Laboratory (Great Britain).)
1398:
situations since multiple threads can call the same callable without fear of interfering with each other. In the
1395:
1323:
830:
651:
232:
31:
3880:
2488:
1964:
1956:
1188:
932:. This syntax can also be used for a callable unit that returns a value, but the return value will be ignored.
914:
882:
805:
439:
280:
2200:, targeted to the student first learning how to program in a text-based language, a callable unit is called a
1032:
A copy of the argument is passed in and the value computed during the call is copied to the argument on return
3794:
992:, such as Pascal, Delphi, Simula, CPL, PL/M, Modula, Oberon, Ada, and many others including C, C++ and Java
4180:
3754:
3305:
3300:
2695:
does not include an ampersand since the compiler handles passing by reference without syntax in the call.
2267:
1949:
1896:
1724:
1390:
1196:
1118:
594:
531:
520:
173:
117:
The meaning of each callable term (function, procedure, method, ...) is, in fact, different. They are not
1167:
If supported by the language, a callable may call itself, causing its execution to suspend while another
3732:
2197:
1640:
DECLARE gen_name GENERIC( name WHEN(FIXED BINARY), flame WHEN(FLOAT), pathname OTHERWISE);
716:
152:
76:
608:
The call sequence can be implemented by a sequence of ordinary instructions (an approach still used in
519:
instruction, which combined the saving of the return address with the calling jump, thereby minimizing
3795:'Debunking the "Expensive Procedure Call" Myth; or, Procedure call implementations considered harmful"
545:... JSB MYSUB (Calls subroutine MYSUB.) BB ... (Will return here after MYSUB is done.)
4215:
4200:
3928:
3787:
3636:
3627:
3605:
3336:
1995:
1421:
1027:
40:
4025:
3678:
2471:
This has a side-effect – modifies the variable passed by reference and could be called for variable
1147:
owned by a callable to hold intermediate values. These variables are typically stored in the call's
917:
in order to consume the return value. For example, a square root callable unit might be called like
3951:
3341:
3331:
3286:
3020:
2263:
2002:
1811:
1775:
1111:
858:
826:
822:
486:
382:
3761:
3315:
1922:
1845:
1827:
1343:
963:, to match. Different programming languages provide different conventions for passing arguments.
815:
574:
500:
398:
345:
248:
2585:
This function returns the integer value 5. The call can be stand-alone or in an expression like
4007:
3997:
3989:
3961:
3862:
3852:
3814:
3585:
3467:
3428:
3403:
3326:
2817:
2813:
2717:
change_sign: procedure(array); declare array(*,*) float; array = -array; end change_sign;
2313:
1960:
1831:
1798:
1779:
1706:
1110:, who is known for promoting design principles. Martin argues that side effects can result in
1096:
997:
786:
762:
4051:
3702:"Part II, Volume I-3, Planning and Coding of Problems for an Electronic Computing Instrument"
719:
of a program. Execution continues at the next instruction after the call instruction when it
647:, since each nested call to the same procedure gets a separate instance of its private data.
597:, to implement function calls and returns. Each procedure call creates a new entry, called a
445:
One of the first programming languages to support user-written subroutines and functions was
3846:
3645:
3610:
Proposals for
Development in the Mathematics Division of an Automatic Computing Engine (ACE)
3502:
3459:
2058:. Control jumps to the specified line number and then continues on the next line on return.
2014:
1826:
translates call and return statements into machine instructions according to a well-defined
1790:
1107:
792:
720:
496:
363:
359:
3538:
743:
Most modern programming languages provide features to define and call functions, including
549:
to call a subroutine called MYSUB from the main program. The subroutine would be coded as
4205:
3310:
2709:
2010:
1919:
Dividing a large programming task among various programmers or various stages of a project
1359:
1327:
1319:
935:
Some older languages require a keyword for calls that do not consume a return value, like
659:
491:
300:
3902:
329:
used the terms "bury" and "unbury" as a means of calling and returning from subroutines.
1928:
Improving readability of code by replacing a block of code with a function call where a
654:
environment, there is generally more than one stack. An environment that fully supports
3578:
2821:
2302:
1906:
1900:
1695:
1668:. Depending on the implementation, closures can serve as a mechanism for side-effects.
1144:
1014:
732:
672:
402:
326:
260:
87:
72:
4075:
3070:. But the same procedure can be called with other input-output patterns. For example:
2499:. A function definition starts with the name of the type of value that it returns or
1978:
With respect to naming, many developers name a callable with a phrase starting with a
271:
are generally credited with the formal invention of this concept, which they termed a
4194:
3573:
3291:
2309:
1450:
1347:
1100:
980:
319:
3709:
Report on the
Mathematical and Logical aspects of an Electronic Computing Instrument
3454:(1982). "Preparation of Problems for EDVAC-Type Machines". In Randell, Brian (ed.).
1895:
a complex programming task into simpler steps: this is one of the two main tools of
3451:
3395:
3346:
2298:
2259:
1936:
1863:
1699:
1044:
470:
466:
268:
244:
186:
3808:
3463:
2282:
to return a value. When used in the context of a class, a procedure is a method.
410:(1961) is one of the first computers to store subroutine return data on a stack.
255:
and recorded in a
January 1947 Harvard symposium on "Preparation of Problems for
3957:
3563:
3491:
2339:
For a simple type like a number these conventions are relatively clear. Passing
2035:
1103:, halting the program or the machine, or temporarily pausing program execution.
566:
315:
284:
121:. Nevertheless, they each add a capability to programming that has commonality.
102:
94:
1095:
behavior such as modifying passed or global data, reading from or writing to a
4011:
3866:
3650:
3631:
3266:, a subprogram that is called after its parameters are set by other activities
2005:
advocate that each callable should have minimal dependency on the rest of the
1913:
1703:
1677:
1339:
1152:
755:
590:
527:
378:
374:
292:
118:
98:
17:
2551:
This function does not return a value and is always called stand-alone, like
694:
returns without making any other call, the call stack is not used at all. If
662:
may use data structures other than stacks to store their activation records.
453:
and other early programming languages also supported procedural programming.
287:
had discussed subroutines in a paper of 1945 on design proposals for the NPL
3295:
3280:
2286:
1983:
1204:
1172:
773:
766:
655:
308:
106:
3366:
3507:
3725:
The
Operational Characteristics of the Processors for the Burroughs B5000
2006:
1823:
1794:
1006:
989:
450:
394:
386:
370:
304:
80:
924:
A callable unit that does not return a value is called as a stand-alone
465:
Many early computers loaded the program instructions into memory from a
3790:
2416:
This returns the value 5, and a call can be part of an expression like
1753:
Various techniques are employed to minimize the runtime cost of calls.
1749:
Dispatching such as for a virtual method in an object-oriented language
1314:
850:
538:
446:
3499:
Proceedings of the 1952 ACM national meeting (Pittsburgh) on - ACM '52
1975:
Many programming conventions have been developed regarding callables.
1019:
The value computed during the call is copied to the argument on return
643:
However, another advantage of the call stack method is that it allows
366:
wrote a paper dated 16 August 1948 discussing the use of subroutines.
1335:
811:
Identify variables outside the function that are accessible within it
751:
Delimit the implementation of a function from the rest of the program
632:
stack contains only the private data of the calls that are currently
578:
426:
422:
418:
3992:. In Böckenhauer, Hans-Joachim; Komm, Dennis; Unger, Walter (eds.).
3283:, subprograms that call each other as if both were the main programs
2507:
2492:
2376:
The does not return a value and has to be called stand-alone, like
2343:
allows the procedure to modify the passed variable whereas passing
1457:
1195:
Recursion allows direct implementation of functionality defined by
886:
205:, is the name of a callable that does not return a value whereas a
1331:
1180:
862:
558:
MYSUB, I which branched to the location stored at location MYSUB.
414:
407:
390:
353:
349:
256:
252:
3848:
PThreads
Programming: A POSIX Standard for Better Multiprocessing
3400:
The Art of Computer Programming, Volume I: Fundamental Algorithms
1948:
Compared to using in-line code, invoking a function imposes some
865:, use a different name for a callable unit that returns a value (
2704:
2294:
2034:
Early BASIC variants require each line to have a unique number (
1987:
1979:
1402:
1373:
1184:
1063:
Like by-value except that the parameter is treated as a constant
3294:, a subprogram that is called in response to an input event or
299:
years. The earliest computers and microprocessors, such as the
3845:
Buttlar, Dick; Farrell, Jacqueline; Nichols, Bradford (1996).
2816:, logical implications behave as goal-reduction procedures. A
1810:
Callables can be defined within a program, or separately in a
1469:// returns the area of a rectangle defined by height and width
1399:
1203:. Here is an example of a recursive function in C/C++ to find
947:
Most implementations, especially in modern languages, support
3813:. Prentice-Hall software series. Prentice-Hall. p. 195.
139:
were more commonly used in the past but are less common today
1680:
behavior, a callable may need to inform the caller about an
1002:
A reference to the argument is passed; typically its address
913:
If declared to return a value, a call can be embedded in an
27:
Sequence of program instructions invokable by other software
4101:"Small Basic Getting Started Guide: Chapter 9: Subroutines"
369:
Some very early computers and microprocessors, such as the
3524:
Preparation of Programs for an Electronic Digital Computer
1959:
code – both at the entry to, and exit from, the function (
4181:"4. More Control Flow Tools — Python 3.9.7 documentation"
3797:. Section "C. Why Procedure Calls Have a Bad Reputation".
1888:
Advantages of breaking a program into functions include:
1862:, is a function for which the compiler generates code at
818:
out of a function and to handle it in the calling context
105:
that is compiled to machine code that implements similar
1449:
Overloading is supported in many languages that support
789:
that correspond to a called function's formal parameters
1998:, and their roles in the program must remain distinct.
1740:
Copying values after the call into the caller's context
243:
The idea of a callable unit was initially conceived by
3953:
Clean Code: A Handbook of Agile Software Craftsmanship
449:. The IBM FORTRAN II compiler was released in 1958.
2720:
This could be called with various arrays as follows:
2479:. Giving v is 5 before the call, it will be 7 after.
589:
Most modern implementations of a function call use a
3810:
Introduction to the PDP-11 and Its Assembly Language
2714:
element of a two-dimensional array might look like:
3423:O.-J. Dahl; E. W. Dijkstra; C. A. R. Hoare (1972).
3059:
3035:
2999:
2274:is used for the callable unit concept. The keyword
678:This overhead is most obvious and objectionable in
352:team and developed an idea for subroutines for the
206:
194:
3577:
1520:// returns the area of a circle defined by radius
1066:PL/I NONASSIGNABLE parameters, Ada IN parameters
495:instruction, whose operand, instead of being the
93:Callable units are present at multiple levels of
3584:. Oxford: Oxford University Press. p. 383.
3522:Wilkes, M. V.; Wheeler, D. J.; Gill, S. (1951).
2522:. A function outside of a class can be called a
3323:, a function that is not bound to an identifier
2844:behaves as a procedure that reduces goals that
2289:that can be specified, but if not, defaults to
335:
176:, having no side-effects, but in many contexts
97:in the programming environment. For example, a
3700:Herman H. Goldstine; John von Neumann (1947).
3539:""open subroutine." A Dictionary of Computing"
1684:condition that occurred during its execution.
1005:Selectable in most Algol-like languages after
3713:(see p. 163 of the pdf for the relevant page)
291:, going so far as to invent the concept of a
8:
1731:Allocating and reclaiming call stack storage
489:, computer designers eventually provided an
348:had worked closely with John Mauchly on the
2859:Consider, for example, the Prolog program:
1727:, which may include but is not limited to:
1106:Side effects are considered undesireble by
988:Default in most Algol-like languages after
821:Package functions into a container such as
779:Specify a return value in the function body
565:Incidentally, a similar method was used by
3446:
3444:
2804:to write "Welcome Martin" to the console.
2526:to distinguish it from a member function.
2308:VB supports parameter passing conventions
795:control to the caller at the point of call
499:itself, was the location of a variable or
3649:
3506:
1990:when it is used to substitute variables.
1394:. A reentrant callable is also useful in
1171:execution of the same callable executes.
1155:along with other information such as the
901:. The C-family languages use the keyword
897:, use only one name for a callable unit,
3851:. "O'Reilly Media, Inc.". pp. 2–5.
3580:Alan Turing's Automatic Computing Engine
1734:Saving and restoring processor registers
1346:, could use one of those registers as a
965:
801:Dispose of the values returned by a call
747:for accessing such features, including:
3671:"Walter Isaacson on the Women of ENIAC"
3492:"The use of sub-routines in programmes"
3358:
1955:A function typically requires standard
1814:that can be used by multiple programs.
3763:Programmed Data Processor 6 - Handbook
3669:Isaacson, Walter (18 September 2014).
3321:Lambda function (computer programming)
3019:is represented by a relation, as in a
1091:In many contexts, a callable may have
798:Consume the return value in the caller
3664:
3662:
2998:Notice that the motherhood function,
1986:when it makes an inquiry, and with a
1982:when it does a certain task, with an
1456:Here is an example of overloading in
7:
2812:In the procedural interpretation of
2328:is specified, an argument is passed
1743:Automatic testing of the return code
231:to refer to a member function of an
3950:Martin, Robert C. (1 August 2008).
2707:a called procedure may be passed a
83:and can be invoked multiple times.
4167:"what is meant by a free function"
1967:and return address as a minimum).
25:
3034:For example, the procedure call
2852:to subgoals that are instances of
610:reduced instruction set computing
3456:The Origins of Digital Computers
2336:is rarely explicitly specified.
1709:, one would write, for example:
698:needs to call another procedure
314:Subroutines were implemented in
2834:which has the logical reading:
2278:is used to return no value and
1176:context such static or global.
985:A copy of the argment is passed
951:which the callable declares as
503:containing the return address.
4141:"Dim statement (Visual Basic)"
3458:. Springer. pp. 393–397.
2495:, a callable unit is called a
1961:function prologue and epilogue
1:
4103:. Microsoft. 17 January 2024.
3990:"A Master Class on Recursion"
1923:Hiding implementation details
1870:to the programming language.
1464:that accept different types:
1406:transaction processing system
1201:divide and conquer algorithms
905:to indicate no return value.
881:). Other languages, such as
4115:"Procedures in Visual Basic"
3464:10.1007/978-3-642-61812-3_31
2514:(as non-static) is called a
2293:for later versions based on
3264:Asynchronous procedure call
2510:, a function declared in a
2017:callables to accept passed
776:to the return value, if any
638:automatic memory management
623:Some designs, notably some
4232:
3632:"The other Turing machine"
2009:. For example, the use of
1925:from users of the function
1843:
1654:Closure (computer science)
1651:
1419:
1357:
614:very long instruction word
29:
3996:. Springer. p. 616.
3807:Frank, Thomas S. (1983).
1965:general purpose registers
1324:general-purpose registers
1125:, a function can have no
873:) vs. one that does not (
4056:. April 2023. p. 87
3881:"ARM Information Center"
3755:"Push-Down Instructions"
3270:Command–query separation
3072:
2861:
2741:
2647:
2590:
2556:
2528:
2421:
2381:
2353:
2324:, respectively. Unless
2214:
2060:
1916:across multiple programs
1711:
1466:
1209:
1179:Languages going back to
845:Some languages, such as
645:recursive function calls
593:, a special case of the
551:
543:
515:Another advance was the
101:may write a function in
75:that has a well-defined
3651:10.1093/comjnl/20.3.269
3624:Carpenter, Brian Edward
1952:in the call mechanism.
1737:Copying input variables
1426:Some languages support
1163:Nested call – recursion
1114:or order dependencies.
739:General characteristics
537:In systems such as the
485:To remove the need for
481:Return by indirect jump
4211:Programming constructs
3988:Verhoeff, Tom (2018).
3537:Dainith, John (2004).
3425:Structured Programming
3367:"Terminology Glossary"
3306:Functional programming
3301:Function (mathematics)
2246:This can be called as
1950:computational overhead
1897:structured programming
1746:Handling of exceptions
1364:Some languages, e.g.,
1197:mathematical induction
1139:Most contexts support
1119:functional programming
343:
180:refers to any callable
4053:Study Material Python
3733:Burroughs Corporation
3628:Doran, Robert William
3606:Turing, Alan Mathison
3508:10.1145/609784.609816
2285:Each parameter has a
2258:In later versions of
2198:Microsoft Small Basic
1832:prologue and epilogue
1757:Compiler optimization
1313:Early languages like
816:exceptional condition
758:, name, to a function
628:directly accessible.
275:, contrasted with an
251:during their work on
174:mathematical function
163:are similarly related
4026:"Built-in functions"
3931:. Msdn.microsoft.com
3883:. Infocenter.arm.com
3788:Guy Lewis Steele Jr.
3637:The Computer Journal
3337:Operator overloading
3058:produces the output
2762:"Welcome "
2587:y = x + giveMeFive()
2418:y = x + GiveMeFive()
2365:' Some Code Here
2262:(VB), including the
1996:software maintenance
1422:Function overloading
595:stack data structure
383:PIC microcontrollers
293:return address stack
41:computer programming
30:For other uses, see
4147:. 15 September 2021
4121:. 15 September 2021
3711:(Technical report).
3681:on 12 December 2018
3630:(1 January 1977) .
3342:Protected procedure
3332:Modular programming
3287:Evaluation strategy
3031:as callable units.
3021:relational database
2264:latest product line
2066:REM A BASIC PROGRAM
2003:modular programming
1723:A call has runtime
1672:Exception reporting
1022:Ada OUT parameters
937:CALL print("hello")
575:circular references
487:self-modifying code
209:does return a value
3735:. 1963. 5000-21005
3608:(19 March 1946) ,
3427:. Academic Press.
3402:. Addison-Wesley.
3316:Intrinsic function
3276:Compound operation
2792:"Martin"
2235:"Hello!"
1860:intrinsic function
1846:Intrinsic function
1838:Built-in functions
1828:calling convention
1344:UNIVAC 1100 series
1121:languages such as
1039:in-out parameters
955:. A caller passes
804:Provide a private
517:jump to subroutine
511:Jump to subroutine
501:processor register
475:subroutine library
467:punched paper tape
399:calling convention
273:closed sub-routine
249:Kathleen Antonelli
217:languages such as
185:In the context of
4003:978-3-319-98355-4
3903:"x64 stack usage"
3858:978-1-4493-6475-5
3526:. Addison-Wesley.
3473:978-3-642-61814-7
3327:Logic programming
2316:via the keywords
1963:– usually saving
1852:built-in function
1818:Inter-operability
1763:(f(x)-1)/(f(x)+1)
1707:assembly language
1149:activation record
1112:temporal coupling
1097:peripheral device
1070:
1069:
1060:by constant value
957:actual parameters
953:formal parameters
787:actual parameters
763:formal parameters
666:Delayed stacking
397:—typically use a
259:-type Machines."
16:(Redirected from
4223:
4185:
4184:
4177:
4171:
4170:
4163:
4157:
4156:
4154:
4152:
4137:
4131:
4130:
4128:
4126:
4111:
4105:
4104:
4097:
4091:
4090:
4088:
4086:
4072:
4066:
4065:
4063:
4061:
4048:
4042:
4041:
4039:
4037:
4022:
4016:
4015:
3985:
3979:
3978:
3976:
3974:
3947:
3941:
3940:
3938:
3936:
3929:"Function Types"
3925:
3919:
3918:
3916:
3914:
3899:
3893:
3892:
3890:
3888:
3877:
3871:
3870:
3842:
3836:
3835:
3829:
3827:
3804:
3798:
3785:
3779:
3778:
3776:
3774:
3768:
3759:
3751:
3745:
3744:
3742:
3740:
3730:
3720:
3714:
3712:
3706:
3697:
3691:
3690:
3688:
3686:
3677:. Archived from
3666:
3657:
3655:
3653:
3620:
3614:
3612:
3602:
3596:
3595:
3583:
3570:
3560:
3554:
3553:
3551:
3549:
3543:Encyclopedia.com
3534:
3528:
3527:
3519:
3513:
3512:
3510:
3496:
3484:
3478:
3477:
3448:
3439:
3438:
3420:
3414:
3413:
3392:
3386:
3385:
3380:
3378:
3363:
3253:
3250:
3247:
3244:
3241:
3238:
3235:
3232:
3229:
3226:
3223:
3220:
3217:
3214:
3211:
3208:
3205:
3202:
3199:
3196:
3193:
3190:
3187:
3184:
3181:
3178:
3175:
3172:
3169:
3166:
3163:
3160:
3157:
3154:
3151:
3148:
3145:
3142:
3139:
3136:
3133:
3130:
3127:
3124:
3121:
3118:
3115:
3112:
3109:
3106:
3103:
3100:
3097:
3094:
3091:
3088:
3085:
3082:
3079:
3076:
3069:
3068:
3065:
3062:
3057:
3056:
3053:
3050:
3047:
3044:
3041:
3038:
3018:
3017:
3014:
3011:
3008:
3005:
3002:
2994:
2991:
2988:
2985:
2982:
2979:
2976:
2973:
2970:
2967:
2964:
2961:
2958:
2955:
2952:
2949:
2946:
2943:
2940:
2937:
2934:
2931:
2928:
2925:
2922:
2919:
2916:
2913:
2910:
2907:
2904:
2901:
2898:
2895:
2892:
2889:
2886:
2883:
2880:
2877:
2874:
2871:
2868:
2865:
2855:
2851:
2840:
2830:
2803:
2796:
2793:
2790:
2787:
2784:
2781:
2778:
2775:
2772:
2769:
2766:
2763:
2760:
2757:
2754:
2751:
2748:
2745:
2738:
2694:
2687:
2684:
2681:
2678:
2675:
2672:
2669:
2666:
2663:
2660:
2657:
2654:
2651:
2644:
2640:
2633:
2630:
2627:
2624:
2621:
2618:
2615:
2612:
2609:
2606:
2603:
2600:
2597:
2594:
2588:
2581:
2578:
2575:
2572:
2569:
2566:
2563:
2560:
2554:
2547:
2544:
2541:
2538:
2535:
2532:
2502:
2478:
2474:
2467:
2464:
2461:
2458:
2455:
2452:
2449:
2446:
2443:
2440:
2437:
2434:
2431:
2428:
2425:
2419:
2412:
2409:
2406:
2403:
2400:
2397:
2394:
2391:
2388:
2385:
2379:
2372:
2369:
2366:
2363:
2360:
2357:
2350:
2346:
2342:
2335:
2331:
2327:
2323:
2319:
2292:
2281:
2277:
2249:
2242:
2239:
2236:
2233:
2230:
2227:
2224:
2221:
2218:
2211:
2207:
2184:
2181:
2178:
2175:
2172:
2169:
2166:
2163:
2160:
2157:
2154:
2151:
2148:
2145:
2142:
2139:
2136:
2133:
2130:
2127:
2124:
2121:
2118:
2115:
2112:
2109:
2106:
2103:
2100:
2097:
2094:
2091:
2088:
2085:
2082:
2079:
2076:
2073:
2070:
2067:
2064:
2041:
2011:global variables
1909:within a program
1856:builtin function
1773:
1768:
1764:
1636:
1629:
1626:
1623:
1620:
1617:
1614:
1611:
1608:
1605:
1602:
1599:
1596:
1593:
1590:
1587:
1584:
1581:
1578:
1575:
1572:
1569:
1566:
1563:
1560:
1557:
1554:
1551:
1548:
1545:
1542:
1539:
1536:
1533:
1530:
1527:
1524:
1521:
1518:
1515:
1512:
1509:
1506:
1503:
1500:
1497:
1494:
1491:
1488:
1485:
1482:
1479:
1476:
1473:
1470:
1463:
1460:, two functions
1309:
1306:
1303:
1300:
1297:
1294:
1291:
1288:
1285:
1282:
1279:
1276:
1273:
1270:
1267:
1264:
1261:
1258:
1255:
1252:
1249:
1246:
1243:
1240:
1237:
1234:
1231:
1228:
1225:
1222:
1219:
1216:
1213:
1108:Robert C. Martin
1081:
966:
938:
931:
920:
904:
765:with a name and
731:The features of
433:Language support
208:
196:
21:
4231:
4230:
4226:
4225:
4224:
4222:
4221:
4220:
4191:
4190:
4189:
4188:
4179:
4178:
4174:
4165:
4164:
4160:
4150:
4148:
4145:Microsoft Learn
4139:
4138:
4134:
4124:
4122:
4119:Microsoft Learn
4113:
4112:
4108:
4099:
4098:
4094:
4084:
4082:
4074:
4073:
4069:
4059:
4057:
4050:
4049:
4045:
4035:
4033:
4024:
4023:
4019:
4004:
3987:
3986:
3982:
3972:
3970:
3968:
3949:
3948:
3944:
3934:
3932:
3927:
3926:
3922:
3912:
3910:
3901:
3900:
3896:
3886:
3884:
3879:
3878:
3874:
3859:
3844:
3843:
3839:
3825:
3823:
3821:
3806:
3805:
3801:
3786:
3782:
3772:
3770:
3766:
3757:
3753:
3752:
3748:
3738:
3736:
3728:
3722:
3721:
3717:
3704:
3699:
3698:
3694:
3684:
3682:
3668:
3667:
3660:
3622:
3621:
3617:
3604:
3603:
3599:
3592:
3574:Copeland, B. J.
3572:
3564:Turing, Alan M.
3562:
3561:
3557:
3547:
3545:
3536:
3535:
3531:
3521:
3520:
3516:
3501:. p. 235.
3494:
3486:
3485:
3481:
3474:
3450:
3449:
3442:
3435:
3422:
3421:
3417:
3410:
3396:Donald E. Knuth
3394:
3393:
3389:
3376:
3374:
3365:
3364:
3360:
3355:
3311:Fused operation
3260:
3255:
3254:
3251:
3248:
3245:
3242:
3239:
3236:
3233:
3230:
3227:
3224:
3221:
3218:
3215:
3212:
3209:
3206:
3203:
3200:
3197:
3194:
3191:
3188:
3185:
3182:
3179:
3176:
3173:
3170:
3167:
3164:
3161:
3158:
3155:
3152:
3149:
3146:
3143:
3140:
3137:
3134:
3131:
3128:
3125:
3122:
3119:
3116:
3113:
3110:
3107:
3104:
3101:
3098:
3095:
3092:
3089:
3086:
3083:
3080:
3077:
3074:
3066:
3063:
3060:
3054:
3051:
3048:
3045:
3042:
3039:
3036:
3015:
3012:
3009:
3006:
3003:
3000:
2996:
2995:
2992:
2989:
2986:
2983:
2980:
2977:
2974:
2971:
2968:
2965:
2962:
2959:
2956:
2953:
2950:
2947:
2944:
2941:
2938:
2935:
2932:
2929:
2926:
2923:
2920:
2917:
2914:
2911:
2908:
2905:
2902:
2899:
2896:
2893:
2890:
2887:
2884:
2881:
2878:
2875:
2872:
2869:
2866:
2863:
2853:
2849:
2838:
2828:
2824:) of the form:
2810:
2801:
2798:
2797:
2794:
2791:
2788:
2786:format_greeting
2785:
2782:
2779:
2776:
2773:
2770:
2767:
2764:
2761:
2758:
2755:
2752:
2749:
2747:format_greeting
2746:
2743:
2736:
2729:
2724:
2718:
2701:
2692:
2689:
2688:
2685:
2682:
2679:
2676:
2673:
2670:
2667:
2664:
2661:
2658:
2655:
2652:
2649:
2642:
2638:
2635:
2634:
2631:
2628:
2625:
2622:
2619:
2616:
2613:
2610:
2607:
2604:
2601:
2598:
2595:
2592:
2586:
2583:
2582:
2579:
2576:
2573:
2570:
2567:
2564:
2561:
2558:
2552:
2549:
2548:
2545:
2543:/* some code */
2542:
2539:
2536:
2533:
2530:
2516:member function
2500:
2485:
2476:
2472:
2469:
2468:
2465:
2462:
2459:
2456:
2453:
2450:
2447:
2444:
2441:
2438:
2435:
2432:
2429:
2426:
2423:
2417:
2414:
2413:
2410:
2407:
2404:
2401:
2398:
2395:
2392:
2389:
2386:
2383:
2377:
2374:
2373:
2370:
2367:
2364:
2361:
2358:
2355:
2348:
2344:
2340:
2333:
2329:
2325:
2321:
2317:
2290:
2279:
2275:
2256:
2247:
2244:
2243:
2240:
2237:
2234:
2231:
2228:
2225:
2222:
2219:
2216:
2209:
2205:
2194:
2186:
2185:
2182:
2179:
2176:
2173:
2170:
2167:
2164:
2161:
2158:
2155:
2152:
2149:
2146:
2143:
2140:
2137:
2134:
2131:
2128:
2125:
2122:
2119:
2116:
2113:
2110:
2107:
2104:
2101:
2098:
2095:
2092:
2089:
2086:
2083:
2080:
2077:
2074:
2071:
2068:
2065:
2062:
2039:
2032:
2027:
1973:
1946:
1901:data structures
1886:
1881:
1876:
1848:
1840:
1820:
1808:
1788:
1771:
1766:
1765:, the function
1762:
1759:
1721:
1716:
1715:
1674:
1656:
1650:
1641:
1634:
1631:
1630:
1627:
1624:
1621:
1618:
1615:
1612:
1609:
1606:
1603:
1600:
1597:
1594:
1591:
1588:
1585:
1582:
1579:
1576:
1573:
1570:
1567:
1564:
1561:
1558:
1555:
1552:
1549:
1546:
1543:
1540:
1537:
1534:
1531:
1528:
1525:
1522:
1519:
1516:
1513:
1510:
1507:
1504:
1501:
1498:
1495:
1492:
1489:
1486:
1483:
1480:
1477:
1474:
1471:
1468:
1461:
1424:
1418:
1410:quasi-reentrant
1386:
1362:
1360:Nested function
1356:
1328:CDC 6000 series
1320:index registers
1311:
1310:
1307:
1304:
1301:
1298:
1295:
1292:
1289:
1286:
1283:
1280:
1277:
1274:
1271:
1268:
1265:
1262:
1259:
1256:
1253:
1250:
1247:
1244:
1241:
1238:
1235:
1232:
1229:
1226:
1223:
1220:
1217:
1214:
1211:
1165:
1141:local variables
1137:
1135:Local variables
1089:
1079:
1075:
1028:by value-result
945:
936:
929:
918:
911:
902:
843:
782:Call a function
741:
733:implementations
729:
727:Implementations
712:
680:leaf procedures
668:
660:lazy evaluation
587:
573:address. Since
555:
554:
547:
546:
523:significantly.
513:
483:
459:
435:
301:Manchester Baby
277:open subroutine
241:
215:Object-oriented
115:
35:
28:
23:
22:
15:
12:
11:
5:
4229:
4227:
4219:
4218:
4213:
4208:
4203:
4193:
4192:
4187:
4186:
4172:
4158:
4132:
4106:
4092:
4067:
4043:
4032:. 9 March 2017
4017:
4002:
3980:
3966:
3956:(1 ed.).
3942:
3920:
3907:Microsoft Docs
3894:
3872:
3857:
3837:
3819:
3799:
3780:
3746:
3731:. Revision A.
3715:
3692:
3658:
3644:(3): 269–279.
3615:
3597:
3590:
3576:, ed. (2005).
3555:
3529:
3514:
3488:Wheeler, D. J.
3479:
3472:
3440:
3433:
3415:
3408:
3387:
3357:
3356:
3354:
3351:
3350:
3349:
3344:
3339:
3334:
3329:
3324:
3318:
3313:
3308:
3303:
3298:
3289:
3284:
3278:
3273:
3267:
3259:
3256:
3073:
2862:
2842:
2841:
2832:
2831:
2814:logic programs
2809:
2806:
2802:greet_martin()
2742:
2735:, the keyword
2728:
2725:
2722:
2716:
2700:
2697:
2648:
2643:addTwo(&v)
2591:
2557:
2529:
2484:
2481:
2422:
2382:
2354:
2255:
2252:
2215:
2193:
2190:
2061:
2031:
2028:
2026:
2023:
2001:Proponents of
1972:
1969:
1945:
1942:
1941:
1940:
1933:
1926:
1920:
1917:
1910:
1907:duplicate code
1903:
1885:
1882:
1880:
1877:
1875:
1872:
1844:Main article:
1839:
1836:
1819:
1816:
1807:
1804:
1787:
1784:
1780:Rice's theorem
1758:
1755:
1751:
1750:
1747:
1744:
1741:
1738:
1735:
1732:
1720:
1717:
1712:
1696:IBM System/360
1673:
1670:
1652:Main article:
1649:
1646:
1639:
1583:rectangle_area
1467:
1420:Main article:
1417:
1414:
1396:multi-threaded
1385:
1382:
1358:Main article:
1355:
1352:
1210:
1199:and recursive
1164:
1161:
1157:return address
1136:
1133:
1099:, accessing a
1088:
1085:
1074:
1071:
1068:
1067:
1064:
1061:
1057:
1056:
1050:
1047:
1041:
1040:
1033:
1030:
1024:
1023:
1020:
1017:
1011:
1010:
1003:
1000:
994:
993:
986:
983:
977:
976:
973:
970:
944:
941:
930:print("hello")
910:
907:
842:
839:
838:
837:
819:
812:
809:
802:
799:
796:
790:
783:
780:
777:
770:
759:
752:
740:
737:
728:
725:
711:
708:
684:leaf functions
673:stack overflow
667:
664:
652:multi-threaded
586:
583:
552:
544:
512:
509:
497:return address
482:
479:
458:
455:
434:
431:
403:IBM System/360
327:Alan M. Turing
261:Maurice Wilkes
240:
237:
236:
235:
211:
210:
182:
181:
168:Some consider
165:
164:
141:
140:
114:
111:
88:cognitive load
73:software logic
26:
24:
18:Procedure call
14:
13:
10:
9:
6:
4:
3:
2:
4228:
4217:
4214:
4212:
4209:
4207:
4204:
4202:
4199:
4198:
4196:
4182:
4176:
4173:
4168:
4162:
4159:
4146:
4142:
4136:
4133:
4120:
4116:
4110:
4107:
4102:
4096:
4093:
4081:
4077:
4076:"Small Basic"
4071:
4068:
4055:
4054:
4047:
4044:
4031:
4027:
4021:
4018:
4013:
4009:
4005:
3999:
3995:
3991:
3984:
3981:
3969:
3967:9780132350884
3963:
3959:
3955:
3954:
3946:
3943:
3930:
3924:
3921:
3908:
3904:
3898:
3895:
3882:
3876:
3873:
3868:
3864:
3860:
3854:
3850:
3849:
3841:
3838:
3834:
3822:
3820:9780134917047
3816:
3812:
3811:
3803:
3800:
3796:
3792:
3789:
3784:
3781:
3765:
3764:
3756:
3750:
3747:
3734:
3727:
3726:
3719:
3716:
3710:
3703:
3696:
3693:
3680:
3676:
3672:
3665:
3663:
3659:
3652:
3647:
3643:
3639:
3638:
3633:
3629:
3625:
3619:
3616:
3611:
3607:
3601:
3598:
3593:
3591:0-19-856593-3
3587:
3582:
3581:
3575:
3571:reprinted in
3569:
3565:
3559:
3556:
3544:
3540:
3533:
3530:
3525:
3518:
3515:
3509:
3504:
3500:
3493:
3489:
3483:
3480:
3475:
3469:
3465:
3461:
3457:
3453:
3452:Mauchly, J.W.
3447:
3445:
3441:
3436:
3434:0-12-200550-3
3430:
3426:
3419:
3416:
3411:
3409:0-201-89683-4
3405:
3401:
3397:
3391:
3388:
3384:
3372:
3368:
3362:
3359:
3352:
3348:
3345:
3343:
3340:
3338:
3335:
3333:
3330:
3328:
3325:
3322:
3319:
3317:
3314:
3312:
3309:
3307:
3304:
3302:
3299:
3297:
3293:
3292:Event handler
3290:
3288:
3285:
3282:
3279:
3277:
3274:
3271:
3268:
3265:
3262:
3261:
3257:
3071:
3032:
3030:
3026:
3022:
2860:
2857:
2847:
2837:
2836:
2835:
2827:
2826:
2825:
2823:
2819:
2815:
2807:
2805:
2740:
2734:
2726:
2721:
2715:
2712:
2711:
2706:
2698:
2696:
2646:
2589:
2555:
2553:doSomething()
2527:
2525:
2524:free function
2521:
2517:
2513:
2509:
2504:
2498:
2494:
2490:
2482:
2480:
2420:
2380:
2352:
2337:
2332:. Therefore,
2315:
2311:
2306:
2304:
2300:
2296:
2288:
2283:
2273:
2269:
2265:
2261:
2253:
2251:
2213:
2203:
2199:
2191:
2189:
2059:
2057:
2053:
2049:
2048:sub procedure
2046:is short for
2045:
2037:
2029:
2024:
2022:
2020:
2016:
2012:
2008:
2004:
1999:
1997:
1991:
1989:
1985:
1981:
1976:
1970:
1968:
1966:
1962:
1958:
1953:
1951:
1944:Disadvantages
1943:
1938:
1934:
1931:
1927:
1924:
1921:
1918:
1915:
1914:reuse of code
1911:
1908:
1904:
1902:
1899:, along with
1898:
1894:
1891:
1890:
1889:
1883:
1878:
1873:
1871:
1869:
1865:
1861:
1857:
1853:
1847:
1842:
1837:
1835:
1833:
1829:
1825:
1817:
1815:
1813:
1805:
1803:
1800:
1796:
1792:
1785:
1783:
1781:
1778:by virtue of
1777:
1756:
1754:
1748:
1745:
1742:
1739:
1736:
1733:
1730:
1729:
1728:
1726:
1719:Call overhead
1718:
1710:
1708:
1705:
1701:
1697:
1692:
1688:
1685:
1683:
1679:
1671:
1669:
1667:
1666:John McCarthy
1663:
1662:
1655:
1647:
1645:
1638:
1633:PL/I has the
1465:
1459:
1454:
1452:
1451:strong typing
1447:
1445:
1441:
1437:
1433:
1429:
1423:
1415:
1413:
1411:
1407:
1404:
1401:
1397:
1393:
1392:
1383:
1381:
1379:
1375:
1371:
1367:
1361:
1353:
1351:
1349:
1348:stack pointer
1345:
1341:
1337:
1333:
1329:
1325:
1321:
1316:
1208:
1206:
1202:
1198:
1193:
1190:
1186:
1182:
1177:
1174:
1170:
1162:
1160:
1158:
1154:
1150:
1146:
1142:
1134:
1132:
1130:
1128:
1124:
1120:
1115:
1113:
1109:
1104:
1102:
1098:
1094:
1086:
1084:
1072:
1065:
1062:
1059:
1058:
1055:
1051:
1048:
1046:
1043:
1042:
1038:
1034:
1031:
1029:
1026:
1025:
1021:
1018:
1016:
1013:
1012:
1008:
1004:
1001:
999:
996:
995:
991:
987:
984:
982:
979:
978:
974:
971:
968:
967:
964:
962:
958:
954:
950:
942:
940:
933:
927:
922:
916:
908:
906:
900:
896:
892:
888:
884:
880:
876:
872:
868:
864:
860:
856:
852:
848:
840:
836:
832:
828:
824:
820:
817:
814:Propagate an
813:
810:
808:for variables
807:
803:
800:
797:
794:
791:
788:
784:
781:
778:
775:
771:
768:
764:
760:
757:
753:
750:
749:
748:
746:
738:
736:
734:
726:
724:
722:
718:
709:
707:
705:
701:
697:
693:
689:
685:
681:
676:
674:
665:
663:
661:
657:
653:
648:
646:
641:
639:
635:
629:
626:
621:
617:
615:
611:
606:
604:
600:
596:
592:
584:
582:
580:
576:
572:
568:
563:
559:
550:
542:
540:
535:
533:
529:
524:
522:
518:
510:
508:
504:
502:
498:
494:
493:
492:indirect jump
488:
480:
478:
476:
472:
471:punched cards
468:
463:
456:
454:
452:
448:
443:
441:
432:
430:
428:
424:
420:
416:
411:
409:
404:
400:
396:
392:
388:
384:
380:
376:
372:
367:
365:
361:
357:
355:
351:
347:
342:
338:
334:
330:
328:
323:
321:
317:
312:
310:
306:
302:
296:
294:
290:
286:
282:
278:
274:
270:
266:
265:David Wheeler
262:
258:
254:
250:
246:
238:
234:
230:
229:
225:use the term
224:
220:
216:
213:
212:
204:
200:
192:
188:
184:
183:
179:
175:
171:
167:
166:
162:
158:
154:
150:
146:
143:
142:
138:
134:
130:
127:
126:
125:
122:
120:
112:
110:
108:
104:
100:
96:
91:
89:
84:
82:
78:
74:
70:
69:callable unit
66:
62:
58:
54:
50:
46:
42:
37:
33:
19:
4175:
4161:
4149:. Retrieved
4144:
4135:
4123:. Retrieved
4118:
4109:
4095:
4083:. Retrieved
4079:
4070:
4058:. Retrieved
4052:
4046:
4034:. Retrieved
4029:
4020:
3993:
3983:
3971:. Retrieved
3952:
3945:
3935:29 September
3933:. Retrieved
3923:
3911:. Retrieved
3906:
3897:
3887:29 September
3885:. Retrieved
3875:
3847:
3840:
3831:
3824:. Retrieved
3809:
3802:
3783:
3771:. Retrieved
3769:. p. 37
3762:
3749:
3737:. Retrieved
3724:
3718:
3708:
3695:
3683:. Retrieved
3679:the original
3674:
3641:
3635:
3618:
3609:
3600:
3579:
3567:
3558:
3546:. Retrieved
3542:
3532:
3523:
3517:
3498:
3482:
3455:
3424:
3418:
3399:
3390:
3382:
3375:. Retrieved
3370:
3361:
3347:Transclusion
3231:parent_child
3204:parent_child
3111:parent_child
3078:parent_child
3040:parent_child
3033:
3028:
3024:
2997:
2978:father_child
2957:parent_child
2939:mother_child
2918:parent_child
2900:father_child
2882:father_child
2864:mother_child
2858:
2843:
2833:
2811:
2799:
2774:greet_martin
2730:
2719:
2708:
2702:
2690:
2636:
2584:
2550:
2523:
2519:
2515:
2505:
2496:
2486:
2470:
2415:
2375:
2338:
2314:by reference
2307:
2284:
2271:
2260:Visual Basic
2257:
2254:Visual Basic
2245:
2201:
2195:
2187:
2055:
2052:subprocedure
2051:
2047:
2043:
2033:
2000:
1992:
1977:
1974:
1957:housekeeping
1954:
1947:
1937:traceability
1887:
1867:
1864:compile time
1859:
1855:
1851:
1849:
1841:
1821:
1809:
1789:
1760:
1752:
1722:
1700:branch table
1693:
1689:
1686:
1676:Besides its
1675:
1659:
1657:
1642:
1632:
1455:
1448:
1443:
1440:sqrt_complex
1439:
1435:
1431:
1427:
1425:
1409:
1389:
1387:
1363:
1354:Nested scope
1312:
1194:
1178:
1168:
1166:
1148:
1140:
1138:
1131:
1127:side effects
1117:In strictly
1116:
1105:
1090:
1087:Side effects
1076:
1073:Return value
998:by reference
960:
956:
952:
946:
934:
923:
912:
898:
878:
874:
870:
866:
844:
806:naming scope
742:
730:
713:
703:
699:
695:
691:
687:
683:
679:
677:
669:
649:
642:
633:
630:
622:
618:
607:
603:private data
602:
598:
588:
570:
564:
560:
556:
548:
536:
525:
516:
514:
505:
490:
484:
474:
464:
460:
444:
436:
412:
368:
358:
344:
339:
336:
331:
324:
313:
297:
276:
272:
269:Stanley Gill
245:John Mauchly
242:
226:
203:subprocedure
202:
198:
197:, short for
187:Visual Basic
177:
169:
160:
156:
148:
144:
136:
132:
128:
123:
116:
92:
85:
68:
64:
60:
56:
52:
48:
44:
38:
36:
4216:Subroutines
4201:Source code
4080:Small Basic
4060:25 December
4036:25 December
3909:. Microsoft
3685:14 December
3023:. However,
2829:A :- B
2534:doSomething
2378:DoSomething
2359:DoSomething
2270:, the term
2192:Small Basic
2036:line number
2030:Early BASIC
1971:Conventions
1930:descriptive
1893:Decomposing
1874:Programming
1776:undecidable
1682:exceptional
1610:circle_area
1428:overloading
1416:Overloading
1093:side effect
972:Description
919:y = sqrt(x)
909:Call syntax
612:(RISC) and
599:stack frame
567:Lotus 1-2-3
526:In the IBM
473:. The name
425:(1970) and
364:von Neumann
346:Kay McNulty
316:Konrad Zuse
285:Alan Turing
283:. However,
172:to imply a
113:Terminology
103:source code
95:abstraction
4195:Categories
4151:8 February
4125:8 February
4085:8 February
4012:1050567095
3867:1036778036
3773:8 February
3739:8 February
3656:(11 pages)
3548:14 January
3377:9 February
3353:References
3281:Coroutines
3027:in Prolog
2710:descriptor
2562:giveMeFive
2399:GiveMeFive
2387:GiveMeFive
2248:SayHello()
2223:TextWindow
2212:keyword.
2202:subroutine
2056:subroutine
2019:parameters
1935:Improving
1884:Advantages
1879:Trade-offs
1704:System/360
1678:happy path
1444:qrt_matrix
1384:Reentrancy
1340:System/360
1153:call stack
969:Convention
949:parameters
943:Parameters
915:expression
875:subroutine
871:subprogram
756:identifier
754:Assign an
656:coroutines
591:call stack
585:Call stack
528:System/360
447:FORTRAN II
393:, and the
381:, and the
379:Intel 8008
375:Intel 4004
199:subroutine
161:subprogram
149:subroutine
137:subroutine
129:Subprogram
119:synonymous
99:programmer
65:subprogram
57:subroutine
3296:interrupt
3237:elizabeth
3135:elizabeth
3084:elizabeth
3067:elizabeth
3025:relations
2870:elizabeth
2693:addTwo(v)
2483:C and C++
2477:AddTwo(v)
2287:data type
2272:procedure
2229:WriteLine
2021:instead.
1984:adjective
1912:Enabling
1905:Reducing
1436:sqrt_real
1391:reentrant
1207:numbers:
1205:Fibonacci
1173:Recursion
1015:by result
961:arguments
959:, a.k.a.
926:statement
879:procedure
857:and many
774:data type
772:Assign a
767:data type
723:control.
717:execution
706:returns.
457:Libraries
360:Goldstine
325:In 1945,
322:in 1945.
309:call site
153:directory
107:semantics
77:interface
49:procedure
3913:5 August
3566:(1945),
3490:(1952).
3398:(1997).
3371:nist.gov
3258:See also
3029:function
2497:function
2454:intValue
2448:intValue
2436:intValue
2411:Function
2384:Function
2310:by value
2280:Function
2220:SayHello
2025:Examples
2015:refactor
2007:codebase
1868:built in
1824:compiler
1799:optimize
1795:compiler
1791:Inlining
1786:Inlining
1725:overhead
1326:, e.g.,
1007:Algol 60
990:Algol 60
981:by value
975:Used in
899:function
867:function
859:dialects
785:Provide
769:for each
710:Features
521:overhead
451:ALGOL 58
421:(1966),
413:The DEC
395:IBM 1130
387:UNIVAC I
371:IBM 1620
305:RCA 1802
303:and the
207:Function
178:function
170:function
81:behavior
45:function
32:Function
4030:ibm.com
3958:Pearson
3791:AI Memo
3675:Fortune
3243:charles
3210:william
3195:william
3183:charles
3159:charles
3147:charles
3102:charles
3052:charles
2906:charles
2894:william
2888:charles
2876:charles
2442:Integer
2396:Integer
2299:variant
2204:. The
1812:library
1806:Sharing
1694:In the
1661:closure
1648:Closure
1635:GENERIC
1315:Fortran
1151:on the
1123:Haskell
1052:Algol,
1045:by name
1035:Algol,
851:Fortran
827:library
761:Define
721:returns
562:calls.
539:HP 2100
239:History
157:program
145:Routine
133:routine
67:) is a
61:routine
4206:Holism
4010:
4000:
3973:19 May
3964:
3865:
3855:
3826:6 July
3817:
3588:
3470:
3431:
3406:
3373:. NIST
3007:mother
2848:with
2839:A if B
2822:clause
2808:Prolog
2759:return
2733:Python
2727:Python
2653:addTwo
2596:addTwo
2571:return
2520:method
2427:AddTwo
2291:Object
2241:EndSub
2210:EndSub
2183:RETURN
2129:SQUARE
2105:NUMBER
2042:where
1607:double
1580:double
1544:return
1532:double
1523:double
1502:return
1490:double
1481:double
1472:double
1378:Python
1370:Pascal
1336:GE 635
1266:return
1254:return
1169:nested
1145:memory
847:Pascal
841:Naming
831:object
823:module
793:Return
745:syntax
634:active
579:IBM PC
571:return
440:macros
427:VAX-11
423:PDP-11
419:PDP-10
389:, the
373:, the
267:, and
233:object
228:method
53:method
47:(also
3793:443.
3767:(PDF)
3758:(PDF)
3729:(PDF)
3705:(PDF)
3495:(PDF)
3272:(CQS)
3216:harry
3171:harry
2912:harry
2846:unify
2780:print
2662:&
2512:class
2475:like
2433:ByRef
2349:ByVal
2345:ByVal
2341:ByRef
2334:ByVal
2330:ByVal
2326:ByRef
2322:ByRef
2318:ByVal
2153:PRINT
2120:PRINT
2090:INPUT
2072:GOSUB
2040:GOSUB
1858:, or
1854:, or
1332:PDP-6
1242:<=
1181:ALGOL
1054:Scala
1037:Swift
928:like
863:BASIC
835:class
833:, or
650:In a
625:Forth
532:stack
415:PDP-6
408:B5000
391:PDP-1
354:ENIAC
350:ENIAC
281:macro
257:EDVAC
253:ENIAC
63:, or
4153:2024
4127:2024
4087:2024
4062:2023
4038:2023
4008:OCLC
3998:ISBN
3975:2024
3962:ISBN
3937:2013
3915:2019
3889:2013
3863:OCLC
3853:ISBN
3828:2016
3815:ISBN
3775:2024
3741:2024
3687:2018
3586:ISBN
3550:2013
3468:ISBN
3429:ISBN
3404:ISBN
3379:2024
2820:(or
2818:rule
2768:name
2753:name
2705:PL/I
2699:PL/I
2650:void
2593:void
2531:void
2501:void
2491:and
2320:and
2312:and
2301:for
2297:and
2295:.NET
2266:and
2168:SQRT
2132:ROOT
2096:GIVE
2081:GOTO
1988:noun
1980:verb
1616:Area
1589:Area
1571:main
1559:3.14
1526:Area
1475:Area
1462:Area
1432:sqrt
1403:CICS
1374:PL/I
1187:and
1185:PL/I
1101:file
1080:void
903:void
895:Lisp
893:and
377:and
362:and
247:and
223:Java
221:and
189:and
159:and
147:and
135:and
79:and
43:, a
3646:doi
3503:doi
3460:doi
3249:yes
2777:():
2771:def
2744:def
2737:def
2731:In
2703:In
2659:int
2641:as
2602:int
2559:int
2518:or
2508:C++
2506:In
2493:C++
2487:In
2466:Sub
2463:End
2424:Sub
2408:End
2371:Sub
2368:End
2356:Sub
2303:VB6
2276:Sub
2268:VB6
2217:Sub
2206:Sub
2196:In
2180:130
2150:120
2126:THE
2117:110
2087:100
2075:100
2054:or
2044:sub
1797:to
1568:int
1458:C++
1400:IBM
1366:Ada
1322:or
1290:Fib
1269:Fib
1221:int
1215:Fib
1212:int
887:C++
877:or
869:or
861:of
855:Ada
682:or
658:or
318:'s
289:ACE
279:or
201:or
195:Sub
191:Ada
71:of
39:In
4197::
4143:.
4117:.
4078:.
4028:.
4006:.
3960:.
3905:.
3861:.
3830:.
3760:.
3707:.
3673:.
3661:^
3642:20
3640:.
3634:.
3626:;
3541:.
3497:.
3466:.
3443:^
3381:.
3369:.
3246:).
3228:?-
3222:no
3219:).
3201:?-
3126:).
3108:?-
3093:).
3075:?-
3037:?-
2993:).
2975::-
2954:).
2936::-
2915:).
2897:).
2879:).
2856:.
2795:))
2756:):
2677:+=
2623:+=
2620:pi
2608:pi
2565:()
2537:()
2439:as
2393:as
2390:()
2362:()
2305:.
2250:.
2159:IS
2135:OF
2099:ME
2084:20
2078:30
2069:20
2063:10
2050:,
1850:A
1834:.
1822:A
1658:A
1625:);
1604:);
1574:()
1446:.
1442:,
1438:,
1408:,
1376:,
1372:,
1368:,
1350:.
1342:,
1338:,
1334:,
1330:,
1305:);
1233:if
1183:,
1159:.
1143:–
939:.
921:.
891:C#
889:,
885:,
853:,
849:,
829:,
825:,
640:.
581:.
534:.
320:Z4
311:.
295:.
263:,
219:C#
193:,
155:;
131:,
59:,
55:,
51:,
4183:.
4169:.
4155:.
4129:.
4089:.
4064:.
4040:.
4014:.
3977:.
3939:.
3917:.
3891:.
3869:.
3777:.
3743:.
3689:.
3654:.
3648::
3594:.
3552:.
3511:.
3505::
3476:.
3462::
3437:.
3412:.
3252:.
3240:,
3234:(
3225:.
3213:,
3207:(
3198:.
3192:=
3189:Y
3186:,
3180:=
3177:X
3174:.
3168:=
3165:Y
3162:,
3156:=
3153:X
3150:.
3144:=
3141:Y
3138:,
3132:=
3129:X
3123:Y
3120:,
3117:X
3114:(
3105:.
3099:=
3096:Y
3090:Y
3087:,
3081:(
3064:=
3061:X
3055:)
3049:,
3046:X
3043:(
3016:)
3013:Y
3010:(
3004:=
3001:X
2990:Y
2987:,
2984:X
2981:(
2972:)
2969:Y
2966:,
2963:X
2960:(
2951:Y
2948:,
2945:X
2942:(
2933:)
2930:Y
2927:,
2924:X
2921:(
2909:,
2903:(
2891:,
2885:(
2873:,
2867:(
2854:B
2850:A
2789:(
2783:(
2765:+
2750:(
2686:}
2683:;
2680:2
2674:i
2671:{
2668:)
2665:i
2656:(
2639:v
2632:}
2629:;
2626:2
2617:*
2614:{
2611:)
2605:*
2599:(
2580:}
2577:;
2574:5
2568:{
2546:}
2540:{
2489:C
2473:v
2460:2
2457:+
2451:=
2445:)
2430:(
2405:5
2402:=
2238:)
2232:(
2226:.
2177:)
2174:N
2171:(
2165:;
2162:”
2156:“
2147:;
2144:N
2141:;
2138:”
2123:“
2114:N
2111:;
2108:”
2102:A
2093:“
1772:x
1767:f
1628:}
1622:5
1619:(
1613:=
1601:4
1598:,
1595:3
1592:(
1586:=
1577:{
1565:}
1562:;
1556:*
1553:r
1550:*
1547:r
1541:{
1538:)
1535:r
1529:(
1517:}
1514:;
1511:w
1508:*
1505:h
1499:{
1496:)
1493:w
1487:,
1484:h
1478:(
1308:}
1302:2
1299:-
1296:n
1293:(
1287:+
1284:)
1281:1
1278:-
1275:n
1272:(
1263:}
1260:;
1257:n
1251:{
1248:)
1245:1
1239:n
1236:(
1230:{
1227:)
1224:n
1218:(
1189:C
883:C
704:Q
700:Q
696:P
692:P
688:P
34:.
20:)
Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.