(Un)portable defer in C
Summary
The article surveys how to emulate defer in C across different toolchains and standards, comparing approaches like C23 with GNU cleanup, C11 adaptations, GCC/Clang blocks, MSVC's structured exception handling, and stack-based and runtime alternatives. It discusses portability, standardization gaps, and practical trade-offs, concluding that a GCC/Clang friendly path offers broad compatibility without waiting on a C standard defer.