Résumé
In computer programming, a function or subroutine is a sequence of program instructions that performs a specific task, packaged as a unit. This unit can then be used in programs wherever that particular task should be performed. Functions may be defined within programs, or separately in libraries that can be used by many programs. In different programming languages, a function may be called a routine, subprogram, subroutine, or procedure; in object-oriented programming (OOP), it may be called a method. Technically, these terms all have different definitions, and the nomenclature varies from language to language. The generic umbrella term callable unit is sometimes used. A function is often coded so that it can be started several times and from several places during one execution of the program, including from other functions, and then branch back (return) to the next instruction after the call, once the function's task is done. The idea of a subroutine was initially conceived by John Mauchly and Kathleen Antonelli during their work on ENIAC, and recorded in a January 1947 Harvard symposium on "Preparation of Problems for EDVAC-type Machines". Maurice Wilkes, David Wheeler, and Stanley Gill are generally credited with the formal invention of this concept, which they termed a closed sub-routine, contrasted with an open subroutine or macro. However, Alan Turing had discussed subroutines in a paper of 1945 on design proposals for the NPL ACE, going so far as to invent the concept of a return address stack. Functions are a powerful programming tool, and the syntax of many programming languages includes support for writing and using subroutines. Judicious use of functions (for example, through the structured programming approach) will often substantially reduce the cost of developing and maintaining a large program, while increasing its quality and reliability. Functions, often collected into libraries, are an important mechanism for sharing and trading software.
À propos de ce résultat
Cette page est générée automatiquement et peut contenir des informations qui ne sont pas correctes, complètes, à jour ou pertinentes par rapport à votre recherche. Il en va de même pour toutes les autres pages de ce site. Veillez à vérifier les informations auprès des sources officielles de l'EPFL.
Publications associées (60)
Concepts associés (126)
Branchement
En informatique, un branchement est une opération consistant à se déplacer au sein d'un code exécuté par un processeur, en « sautant » à une adresse identifiée au lieu de poursuivre l'exécution du code séquentiellement. Un processeur est une unité de traitement séquentielle, ce qui signifie qu'il exécute un ensemble d'instructions en effectuant celles-ci les unes après les autres.
Foobar
The terms foobar (ˈfuːbɑr), foo, bar, baz, and others are used as metasyntactic variables and placeholder names in computer programming or computer-related documentation. They have been used to name entities such as variables, functions, and commands whose exact identity is unimportant and serve only to demonstrate a concept. The style guide for Google developer documentation recommends against using them as example project names, because they are unclear and can cause confusion.
Sequence point
In C and C++, a sequence point defines any point in a computer program's execution at which it is guaranteed that all side effects of previous evaluations will have been performed, and no side effects from subsequent evaluations have yet been performed. They are a core concept for determining the validity of and, if valid, the possible results of expressions. Adding more sequence points is sometimes necessary to make an expression defined and to ensure a single valid order of evaluation.
Afficher plus
Cours associés (28)
CS-119(c): Information, Computation, Communication
L'objectif de ce cours est d'introduire les étudiants à la pensée algorithmique, de les familiariser avec les fondamentaux de l'Informatique et de développer une première compétence en programmation (
MATH-126: Geometry for architects II
Ce cours traite des 3 sujets suivants : la perspective, la géométrie descriptive, et une initiation à la géométrie projective.
ME-213: Programmation pour ingénieur
Mettre en pratique les bases de la programmation vues au semestre précédent. Développer un logiciel structuré. Méthode de debug d'un logiciel. Introduction à la programmation scientifique. Introductio
Afficher plus