Exception handling (programming): Difference between revisions

Content deleted Content added
History: Add Fortran history
Syntax: Source reads more like a technical report than like a journal article. It was not published in a journal.
Line 78:
</syntaxhighlight>
 
C does not have try-catch exception handling, but uses [[return code]]s for error checking. The [[Setjmp.h|<code>setjmp</code> and <code>longjmp</code>]] standard library functions can be used to implement try-catch handling via macros.<ref>{{citeCite journal |last1=Roberts |first1=Eric S. |title=Implementing Exceptions in C |date=21 March 1989report |url=http://bitsavers.informatik.uni-stuttgart.de/pdf/dec/tech_reports/SRC-RR-40.pdf |access-title=Implementing Exceptions in C |last=Roberts |first=Eric S. |date=421 JanuaryMarch 20221989 |publisher=[[DEC Systems Research Center]] |id=SRC-RR-40 |access-date=4 January 2022}}</ref>
 
[[Perl]] 5 uses <code>die</code> for <code>throw</code> and {{code|eval {} if ($@) {}|perl}} for try-catch. It has CPAN modules that offer try-catch semantics.<ref>{{cite book |last1=Christiansen |first1=Tom |last2=Torkington |first2=Nathan |title=Perl cookbook |date=2003 |publisher=O'Reilly |___location=Beijing |isbn=0-596-00313-7 |edition=2nd |url=https://docstore.mik.ua/orelly/perl4/cook/ch10_13.htm |chapter=10.12. Handling Exceptions}}</ref>