Horizon Posted August 30 Share Posted August 30 The C++ language has two large categories of “don’t do that” known as undefined behavior and ill-formed program. What’s the difference? The Difference Between Undefined Behavior and Ill-formed C++ Programs by Raymond Chen From the article: The C++ language has two large categories of “don’t do that” known as undefined behavior and ill-formed program. What’s the difference? Undefined behavior (commonly abbreviated UB) is a runtime concept. If a program does something which the language specified as “a program isn’t allowed to do that”, then the behavior at runtime is undefined: The program is permitted by the standard to do anything it wants. Furthermore, the effect of undefined behavior can go backward in time and invalidate operations that occurred prior to the undefined behavior. It can do things like execute dead code. However, if your program avoids the code paths which trigger undefined behavior, then you are safe. View the full article Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.