Skip to content

Latest commit

 

History

History
58 lines (51 loc) · 1.77 KB

writing-a-termination-handler.md

File metadata and controls

58 lines (51 loc) · 1.77 KB
title Writing a Termination Handler
ms.custom na
ms.date 10/14/2016
ms.prod visual-studio-dev14
ms.reviewer na
ms.suite na
ms.technology
devlang-cpp
ms.tgt_pltfrm na
ms.topic language-reference
dev_langs
C++
helpviewer_keywords
structured exception handling, termination handlers
exceptions, terminating
termination handlers, writing
handlers
handlers, termination
termination handlers
exception handling, termination handlers
try-catch keyword [C++], termination handlers
ms.assetid 52aa1f8f-f8dd-44b8-be94-5e2fc88d44fb
caps.latest.revision 7
ms.author mblome
manager ghogen
translation.priority.ht
cs-cz
de-de
es-es
fr-fr
it-it
ja-jp
ko-kr
pl-pl
pt-br
ru-ru
tr-tr
zh-cn
zh-tw

Writing a Termination Handler

Unlike an exception handler, a termination handler is always executed, regardless of whether the protected block of code terminated normally. The sole purpose of the termination handler should be to ensure that resources, such as memory, handles, and files, are properly closed regardless of how a section of code finishes executing.

Termination handlers use the try-finally statement.

What do you want to know more about?

See Also

Structured Exception Handling (C/C++)