Undefined Behavior

What Does Undefined Behavior Mean?

In computer science, undefined behavior happens when a computer language does not handle a certain operation that is coded into a codebase. Some experts describe this as “assumptions made by translators of a source code,” suggesting that when there is not a procedure for a certain syntax, that leads to a problem that is hard to predict in terms of its resolution.


Techopedia Explains Undefined Behavior

Undefined behavior can take many forms. As mentioned, it occurs when some type of problem or operation is not built into the language that a programmer is using. For example, C and C++ have their own range of undefined behaviors according to how the language was created. One common example of undefined behavior is a situation where a program indexes an array outside of its bounds. Other examples have to do with dividing numbers by zero, printing a null value, or pointing to some memory location that is not there. All sorts of bugs or glitches in a computer programming code can create various different kinds of undefined behavior that engineers and programmers need to look out for.


Related Terms

Latest Software Development Terms

Related Reading

Margaret Rouse

Margaret Rouse is an award-winning technical writer and teacher known for her ability to explain complex technical subjects to a non-technical, business audience. Over the past twenty years her explanations have appeared on TechTarget websites and she's been cited as an authority in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine and Discovery Magazine.Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages. If you have a suggestion for a new definition or how to improve a technical explanation, please email Margaret or contact her…