Null function
Type of subroutine in computer science / From Wikipedia, the free encyclopedia
Dear Wikiwand AI, let's keep it short by simply answering these key questions:
Can you list the top facts and stats about Null function?
Summarize this article for a 10 year old
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).
This article needs additional citations for verification. (September 2017) |
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.