Unspecified Condition

Hello Team,
I just wanted to understand, If any condition is unspecified (for example comparison between fixed point and floating point), do we need to handle unspecified cases in code OR we should not keep such cases in our program?


Your program's behavior probably shouldn't depend on any specific
unspecified behavior.
Sometimes it's not possible to avoid invoking unspecified behavior.
For instance - the evaluation order for function arguments is
unspecified, so in "f1(f2(), f3())" it's unspecified whether f2() or
f3() is run first - you can't really /avoid/ that unspecified behavior
if you're writing C++ (maybe you could write "auto &&x = f2(); auto
&&y = f3(); f1(std::move(x), std::move(y)); but implicit conversions,
by-value copies/moves, etc, would still trip this up) - the only thing
to do is ensure that your program does what you want/produces the same
result no matter whether f2 or f3 is run first.

In the context of the question (or at least, the OP's original intent for the question­čśŐ ):

A compiler crashing is not a valid unspecified behavior. We should be properly handling it, but it DOES mean that the result we give isn't guaranteed by the standard. We don't have a way in the compiler of saying "the result of this expression is unspecified", it just means we have a little more freedom with what the behavior IS!

So yes, we do need to handle this in the compiler, we shouldn't allow it to continue crashing, and we can choose among a number of behaviors permitted by the standard.