跳至內容

討論:異常處理

頁面內容不支援其他語言。
維基百科,自由的百科全書
基礎條目 異常處理屬於維基百科科技主題的基礎條目第五級。請勇於更新頁面以及改進條目。
          本條目頁屬於下列維基專題範疇:
電腦和資訊科技專題 (獲評中重要度
本條目頁屬於電腦和資訊科技專題範疇,該專題旨在改善中文維基百科資訊科技相關條目類內容。如果您有意參與,請瀏覽專題主頁、參與討論,並完成相應的開放性任務。
 未評級未評  根據專題品質評級標準,本條目頁尚未接受評級。
   根據專題重要度評級標準,本條目已評為中重要度

In software部分的翻譯[編輯]

Kiniry also notes that "Language design only partially influences the use of exceptions, and consequently, the manner in which one handles partial and total failures during system execution. The other major influence is examples of use, typically in core libraries and code examples in technical books, magazine articles, and online discussion forums, and in an organization’s code standards."

Contemporary applications face many design challenges when considering exception handling strategies. Particularly in modern enterprise level applications, exceptions must often cross process boundaries and machine boundaries. Part of designing a solid exception handling strategy is recognizing when a process has failed to the point where it cannot be economically handled by the software portion of the process.

這兩段有點難理解

九千鴉留言2020年2月3日 (一) 09:07 (UTC)[回覆]

簡介部分[編輯]

原文中的這一塊(已刪除)

各種程式語言在處理異常方面具有非常顯著的不同點(錯誤檢測與異常處理區別在於:錯誤檢測是在正常的程序流中,處理不可預見問題的代碼,例如一個調用操作未能成功結束)。某些程式語言有這樣的函數:當輸入存在非法數據時不能被安全地調用,或者返回值不能與異常進行有效的區別。例如,C語言中的atoi函數(ASCII串到整數的轉換)在輸入非法時可以返回0。在這種情況下編程者需要另外進行錯誤檢測(可能通過某些輔助全局變量如C的errno),或進行輸入檢驗(如通過正則表達式),或者共同使用這兩種方法。

以及這一塊:(未翻譯)

Alternative approaches to exception handling in software are error checking, which maintains normal program flow with later explicit checks for contingencies reported using special return values or some auxiliary global variable such as C's errno or floating point status flags; or input validation to preemptively filter exceptional cases.

這兩塊覺得很奇怪。

九千鴉留言2020年2月4日 (二) 09:21 (UTC)[回覆]