← Back to context

Comment by ibobev

17 hours ago

> An infinite loop should compile to an infinite loop.

I think that a compiler option should control this. It can be a nice optimization, but the programmer should be able to opt out.

Every flag that changes the semantics of the code bifurcates the language into two languages.

  • Alternatively every flag that changes the semantics of the code is a workaround for either legacy code no one will fix or language committee decisions that have unintended side effects.

  • If we accept this definition, C++ already seems to be many different languages. At my job, I'm currently fighting floating-point determinism issues across different build configurations, compilers, CPUs, operating systems, and standard library and libm implementations so that snapshot tests pass with the same hashes on all platforms. I can confirm that this is a complete nightmare.

    • Yup. I tried hard to not allow D's behaviors to be changed based on a compiler switch. Yes, we have switches to enable certain features, but not silent behavior changes.

      It's not perfect, but the forest of such switches in C compilers motivated D to not have them.