fbpx
Wikipedia

Null function

In computer science, a null function (or null operator) is a subroutine that leaves the program state unchanged. When it is part of the instruction set of a processor, it is called a NOP or NOOP (No OPeration).

Mathematically, a (computer) function is null if and only if its execution leaves the program state unchanged. That is, a null function is an identity function whose domain and codomain are both the state space of the program, and for which:

for all elements .

Less rigorous definitions may also be encountered. For example, a function may take a single operand, transform it into a new data type, and return the result.[1] While such usages bear a strong visual resemblance to identity functions, they create or alter a binary data value and thus change the program state. From a software maintainability perspective it is better to identify such "minor" alternations of state explicitly, since calling them null functions provides future maintainers of the code with no insights on their actual purposes.

Uses edit

Null functions have several uses.

During software development, null functions with the same names and type signatures as a planned functions are often used as stubs—that is, as non-functional placeholders that allow the incomplete body of code to be compiled and tested prior to completion of all planned features.

Null functions, particularly the NOP variety, are also used to provide delays of indeterminate length within wait loops. This is a common strategy in dedicated device controllers that must wait for an external input and have no other tasks to perform while they are waiting. Such wait loops are also used in software applications on larger multiprocessing computer systems. However, for multiprocessing systems a better approach is to use operating system functions that let other processes use the CPU during the waiting period.

A third use of null functions is as the definition of a program feature that, if created inadvertently, is almost always deleterious. Unintended null functions can arise during the development of complex programs, and like dead code, such occurrences indicate serious flaws in program structures.

A null function or method is often used as the default behavior of a revectorable function or overrideable method in an object framework.

See also edit

References edit

  1. ^ Example of a type conversion function labeled as a "null function": _NULLF - null function.

External links edit

  • The NULL Encryption Algorithm and Its Use With IPsec. IETF. November 1998. doi:10.17487/RFC2410. RFC 2410. Makes humorous statements about the NULL encryption algorithm.

null, function, confused, with, identity, function, empty, function, zero, function, this, article, needs, additional, citations, verification, please, help, improve, this, article, adding, citations, reliable, sources, unsourced, material, challenged, removed. Not to be confused with identity function empty function or zero function This article needs additional citations for verification Please help improve this article by adding citations to reliable sources Unsourced material may be challenged and removed Find sources Null function news newspapers books scholar JSTOR September 2017 Learn how and when to remove this message In computer science a null function or null operator is a subroutine that leaves the program state unchanged When it is part of the instruction set of a processor it is called a NOP or NOOP No OPeration Mathematically a computer function f displaystyle f is null if and only if its execution leaves the program state s displaystyle s unchanged That is a null function is an identity function whose domain and codomain are both the state space S displaystyle S of the program and for which f s s displaystyle f s s for all elements s S displaystyle s in S Less rigorous definitions may also be encountered For example a function may take a single operand transform it into a new data type and return the result 1 While such usages bear a strong visual resemblance to identity functions they create or alter a binary data value and thus change the program state From a software maintainability perspective it is better to identify such minor alternations of state explicitly since calling them null functions provides future maintainers of the code with no insights on their actual purposes Contents 1 Uses 2 See also 3 References 4 External linksUses editNull functions have several uses During software development null functions with the same names and type signatures as a planned functions are often used as stubs that is as non functional placeholders that allow the incomplete body of code to be compiled and tested prior to completion of all planned features Null functions particularly the NOP variety are also used to provide delays of indeterminate length within wait loops This is a common strategy in dedicated device controllers that must wait for an external input and have no other tasks to perform while they are waiting Such wait loops are also used in software applications on larger multiprocessing computer systems However for multiprocessing systems a better approach is to use operating system functions that let other processes use the CPU during the waiting period A third use of null functions is as the definition of a program feature that if created inadvertently is almost always deleterious Unintended null functions can arise during the development of complex programs and like dead code such occurrences indicate serious flaws in program structures A null function or method is often used as the default behavior of a revectorable function or overrideable method in an object framework See also editIEFBR14References edit Example of a type conversion function labeled as a null function NULLF null function External links editThe NULL Encryption Algorithm and Its Use With IPsec IETF November 1998 doi 10 17487 RFC2410 RFC 2410 Makes humorous statements about the NULL encryption algorithm Retrieved from https en wikipedia org w index php title Null function amp oldid 1195581088, wikipedia, wiki, book, books, library,

article

, read, download, free, free download, mp3, video, mp4, 3gp, jpg, jpeg, gif, png, picture, music, song, movie, book, game, games.