In C++, there are things that come up that are somewhere between well-defined and undefined. Specifically, those are called implementation defined and unspecified. Right now, I'm interested in the unspecified stuff.
When is it okay to use such features, and when should they be avoided? Are there good examples of unspecified behaviour being a part of correct code? When, if ever, is it the best choice to make when writing software?
Definitions provided by Matt McNabb:
Undefined - anything at all can happen
Implementation-defined - a finite number of results are possible, and the compiler's documentation must say what happens
Unspecified - a finite number of results are possible -- usually the Standard describes the set of possible results
Well-defined - none of the above
Well-formed program - program that compiles without error (may exhibit undefined behaviour)
Do relaxed atomics count as unspecified or well-defined?