Skip to Main content Skip to Navigation
New interface

Defer Mechanism for {C}

Abstract : The defer mechanism can restore a previously known property or invariant that is altered during the processing of a code block. The defer mechanism is useful for paired operations, where one operation is performed at the start of a code block and the paired operation is performed before exiting the block. Because blocks can be exited using a variety of mechanisms, operations are frequently paired incorrectly. The defer mechanism in C is intended to help ensure the proper pairing of these operations. This pattern is common in resource management, synchronization, and outputting balanced strings (e.g., parenthesis or HTML). A separable feature of the defer mechanism is a panic/recover mechanism that allows error handling at a distance.
Document type :
Complete list of metadata
Contributor : Jens Gustedt Connect in order to contact the contributor
Submitted on : Wednesday, September 30, 2020 - 10:33:28 AM
Last modification on : Friday, December 9, 2022 - 12:20:27 PM


  • HAL Id : hal-02953399, version 1


Aaron Ballman, Alex Gilding, Jens Gustedt, Tom Scogland, Robert C. Seacord, et al.. Defer Mechanism for {C}. ISO TC1/SC22/WG14, pp.57, 2020. ⟨hal-02953399⟩



Record views