Disabling Assertions
Most languages allow assertions to be enabled or disabled globally, and sometimes independently. Assertions are often enabled during development and disabled during final testing and on release to the customer. Not checking assertions avoids the cost of evaluating the assertions while, assuming the assertions are free of side effects, still producing the same result under normal conditions. Under abnormal conditions, disabling assertion checking can mean that a program that would have aborted will continue to run. This is sometimes preferable.
Some languages, including C and C++, completely remove assertions at compile time using the preprocessor. Java requires an option to be passed to the run-time engine in order to enable assertions. Absent the option, assertions are bypassed, but they always remain in the code unless optimised away by a JIT compiler at run-time or excluded by an if(false) condition at compile time, thus they need not have a run-time space or time cost in Java either.
Programmers can always build checks into their code that are always active by bypassing or manipulating the language's normal assertion-checking mechanisms.
Read more about this topic: Assertion (computing)
Famous quotes containing the words disabling and/or assertions:
“Criminality should be exterminated by disabling all notorious and irreclaimable criminals.”
—Tennessee Claflin (18461923)
“Above and beyond paying attention to feelings before and after a separation, never threaten your child with leaving or loss of love in an effort to control her behavior. Children believe their parents assertions that I will send you away, I wont love you any more, Ill go away, and are terrified with good reason. Fear is a very poor way of disciplining a child, and it can cause severe lifelong anxiety.”
—Alicia F. Lieberman (20th century)