What is forward - TopicsExpress



          

What is forward referencing/Declaration? ================================ In computer programming, a forward declaration is a declaration of an identifier (denoting an entity such as a type, a variable, or a function) for which the programmer has not yet given a complete definition. It is required for a compiler to know the type of an identifier (size for memory allocation, type for type checking, such as signature of functions), but not a particular value it holds (in case of variables) or definition (in the case of functions), and is useful for one-pass compilers. Forward declaration is used in languages that require declaration before use; it is necessary for mutual recursion in such languages, as it is impossible to define these functions without a forward reference in one definition. It is also useful to allow flexible code organization, for example if one wishes to place the main body at the top, and called functions below it. In other languages forward declaration is not necessary, and generally require a multi-pass compiler – identifiers must be defined (variables initialized, functions defined) before they are used in execution, but do not need to be defined lexically before used in compilation or interpretation.
Posted on: Thu, 31 Jul 2014 02:54:51 +0000

Trending Topics



Recently Viewed Topics




© 2015