NOP Code
NOP is sometimes used as a description for the action performed by a function or a sequence of programming language statements if the function or code has no effect (it might also be called redundant code). A common compiler optimization is the detection and removal of this kind of code.
The following is an example of a single C statement that behaves like a NOP (the issue is whether the statement affects program output, not whether or not a compiler generates any code for this statement):
i+1;(This statement performs an addition and discards the result.)
The simplest possible statement in C that behaves like a NOP is the so called null statement, which is just a semi-colon in a context requiring a statement. (A compiler is not required to generate a NOP instruction in this case; typically, no instructions whatsoever would be generated.)
;The null statement is useless by itself, but it can have a syntactic use in a wider context, e.g., within the context of a loop:
while (ReadChar != '\n') ;The above code continues calling the function ReadChar until it returns a \n (newline) character.
Read more about this topic: NOP
Famous quotes containing the word code:
“...I had grown up in a world that was dominated by immature age. Not by vigorous immaturity, but by immaturity that was old and tired and prudent, that loved ritual and rubric, and was utterly wanting in curiosity about the new and the strange. Its era has passed away, and the world it made has crumbled around us. Its finest creation, a code of manners, has been ridiculed and discarded.”
—Ellen Glasgow (18731945)