Content deleted Content added
Axiarchist (talk | contribs) Finished integrating after merge. Note "concept programming" is not a programming paradigm. Removed dead external link. |
m →Type-safe variable argument lists: <source lang="pascal"> |
||
Line 123:
===Type-safe variable argument lists===
Functions can be [[Polymorphism (computer science)|overloaded]]. A function can be declared to use a variable number of arguments by using <code>...</code> in the parameter list (historically, the keyword <code>other</code> was used for that purpose). In such a function, <code>...</code> can be used to pass the variable number of arguments to another subroutine, a feature now called [[Variadic templates]]:
<source lang="pascal">
// Generic function for the minimum of N item
function Min(X : ordered; ...) return ordered is
Line 129:
if X < result then
result := X
</source>
When such a function is called, the compiler recursively instantiates functions to match the parameter list:
|