What language was the first to implement exception handling?

前端 未结 9 2082
不知归路
不知归路 2021-01-01 16:13

This question is not a technical but a historical one. I was just thinking today that I\'ve also thought of Java as the \"first\" language to use exception handling, until I

相关标签:
9条回答
  • 2021-01-01 16:47

    C++ had exceptions before Java did.

    0 讨论(0)
  • 2021-01-01 16:47

    I can remember using exception handlers in Xerox's Mesa language in ... um ... 1984. The language existed well before then. Mesa had an interesting exception model. In addition to propagating and handling an exception in the normal way, a handler could "resume" an exception, causing execution to return from the "throw" statement.

    0 讨论(0)
  • 2021-01-01 16:52

    Exception handling really goes back to even before programming languages; at first, it was a hardware mechanism for trapping error conditions (those that caused an execution halt) and optionally branching to a subroutine.

    For example, the VAX CPU could detect when a virtual address that had no physical mapping was accessed, and call into a subroutine that either loaded the appropriate page from swap, or halted the program. The mechanism is essentially the same in modern processors (look up "translation lookaside buffer"). So in a sense the first language to have exceptions was assembly.

    The earliest structured languages to have exceptions appear to be PL/I and CLU (see Mipadi above).

    0 讨论(0)
提交回复
热议问题