“runtime error” 指程序在运行过程中发生的错误:代码可能能通过编译/解释启动,但在执行到某一步时因异常情况(如除以零、空指针、越界访问、类型不匹配、资源不足等)而崩溃或报错。也常写作 run-time error。在不同语言/环境中,它常以 “exception(异常)” 的形式出现。
/ˈrʌnˌtaɪm ˈɛrər/
The app crashed because of a runtime error.
这个应用因为运行时错误而崩溃了。
The program compiled successfully, but a runtime error occurred when it tried to read a missing file, so the process stopped unexpectedly.
程序成功编译了,但在尝试读取一个不存在的文件时发生了运行时错误,因此进程意外停止。
“runtime” 由 run(运行)+ time(时间) 组成,指“程序实际执行的阶段”;“error” 源自拉丁语 error,意为“偏离、错误”。合起来,“runtime error” 直译为“在运行阶段出现的错误”,用来区别于 compile-time error(编译期错误)。
FileNotFoundError、TypeError)。