- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Difference between undefined, unspecified, and implementation-defined behavior in C and C++?
45 Lectures 4.5 hours
66 Lectures 5.5 hours
Undefined behavior is simply behavior that is not defined by the C++ specification. For example, if you have multiple unary increment/decrement operations in an expression like i++ + ++i, they result in behavior that is not defined. This is simply due to the fact that some language constructs are syntactically valid but you can't predict the behavior when the code is run. Another example is the expression: u = (u++);
Implementation-defined behavior is behavior unspecified by the specification and left for the implementor to decide and document how the choice is made. In this case, the choice that is made must be guaranteed, ie, only that should happen.
In case of unspecified behavior, the C++ standard provides multiple possible paths doesn't require the implementation to document or guarantee anything.
- Is segmentation fault actual undefined behavior in C++?
- Undefined Behaviour in C and C++
- Difference between C and C++.
- Difference Between C# and C++
- Difference between C# and .Net
- Difference between Go and C++.
- Difference between C and Python
- Difference Between C++ and Java
- Difference between C# and Visual C#
- Difference between Structures in C and C++
- Difference between Java and C language
- Difference between C structures and C++ structures
- Difference between strncmp() and strcmp() in C/C++