---
title: "Discussion on \"Zero-Cost defer in C: A Compiler Optimization Odyssey\" | Hashnode"
description: "Discussion on \"Zero-Cost defer in C: A Compiler Optimization Odyssey\". Shows how a Duff's device, two compilers, and a hidden LLVM flag turned a C macro 'defer' into a zero-cost abstraction, with benchmarks."
url: "https://hashnode.com/posts/zero-cost-defer-in-c/69ccbc80b504c4ed0a2a2e9a"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Zero-Cost defer in C: A Compiler Optimization Odyssey](https://dasae-scenic-route.hashnode.dev/zero-cost-defer-in-c?utm_source=hashnode&utm_medium=feed)

Shows how a Duff's device, two compilers, and a hidden LLVM flag turned a C macro 'defer' into a zero-cost abstraction, with benchmarks.

Mar 17 · 62 min read · dasae-scenic-route.hashnode.dev  
Updated Apr 13  
Read the article

-   [#c](https://hashnode.com/tag/c)
-   [#cpp](https://hashnode.com/tag/cpp)
-   [#defer](https://hashnode.com/tag/defer)
-   [#zero-cost-abstraction](https://hashnode.com/tag/zero-cost-abstraction)
-   [#llvm](https://hashnode.com/tag/llvm)
-   [#clang](https://hashnode.com/tag/clang)
-   [#clang-compiler](https://hashnode.com/tag/clang-compiler)
-   [#gcc](https://hashnode.com/tag/gcc)
-   [#gcc-compiler](https://hashnode.com/tag/gcc-compiler)
-   [#compiler](https://hashnode.com/tag/compiler)
-   [#compiler-optimizations](https://hashnode.com/tag/compiler-optimizations)
-   [#optimization](https://hashnode.com/tag/optimization)
-   [#preprocessor](https://hashnode.com/tag/preprocessor)
-   [#macros](https://hashnode.com/tag/macros)
-   [#duffs-device](https://hashnode.com/tag/duffs-device)
-   [#performance](https://hashnode.com/tag/performance)
-   [#benchmarking](https://hashnode.com/tag/benchmarking)
-   [#system-programming](https://hashnode.com/tag/system-programming)

## Written by

[Gyeongtae Kim](https://hashnode.com/@dasae)

@dasae · Busan, South Korea

  
[View profile](https://hashnode.com/@dasae)

SW Engineer as a Challenger, Presenter, and Communicative Leader

Passionate software engineer with a focus on (Game Engine -&gt;) C-like extended language development.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
