← Back to context

Comment by doubled112

2 hours ago

Crash and report an error.

You report an error and exit cleanly with a proper operating system error code. Crashing is a quick hack, acceptable for throwaway projects but not in software used long-term.

  • Crashing (in the sense of "give up and exit with an error") on invalid inputs is valid (and often the best thing) in many cases.

    Fix your inputs.

    • You seem to be using "crash" to mean "exit early". I am using "crash" in the sense of "this program did something causing the OS to terminate it externally". I suppose that's a real point of difficulty in communication across different programming languages.

      We agree that the program should exit early. I think we agree it should do it cleanly and intentionally. I'm adding the constraint that "crash" doesn't necessarily mean "cleanly and intentionally", especially when talking about a C program.