<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/defer-available-in-gcc-and-clang-2as4i32ce" -->

---
title: Defer available in gcc and clang | daily.dev
description: The defer feature for C is now available in gcc and clang compilers, following the completion of ISO Technical Specification 25755. Starting with clang-22 and...
canonical: https://daily.dev/posts/defer-available-in-gcc-and-clang-2as4i32ce
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Defer available in gcc and clang | daily.dev
og:description: The defer feature for C is now available in gcc and clang compilers, following the completion of ISO Technical Specification 25755. Starting with clang-22 and...
og:url: https://daily.dev/posts/defer-available-in-gcc-and-clang-2as4i32ce
og:image: https://api.daily.dev/og/posts/2As4I32Ce.png
og:image:alt: Defer available in gcc and clang
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Defer available in gcc and clang

**[Lobsters](https://daily.dev/sources/lobsters)** · 4 min read · 8 upvotes · 1 comments

## Summary

The defer feature for C is now available in gcc and clang compilers, following the completion of ISO Technical Specification 25755. Starting with clang-22 and gcc-9 onward (with workarounds), developers can use defer for automatic cleanup handling, eliminating resource leaks and simplifying error handling code. The implementation uses nested functions in gcc and native support in clang-22, with practical examples showing memory deallocation and mutex unlocking patterns.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://gustedt.wordpress.com/2026/02/15/defer-available-in-gcc-and-clang/>

## Community discussion

Top comments from developers on daily.dev.

**@andradei** · 0 upvotes

> Nice, it only took 50 years and another 25 for wide adoption.

## Similar posts on daily.dev

- [\(Un\)portable defer in C](https://daily.dev/posts/un-portable-defer-in-c-pcrazm9km) · Anton Zhiyanov · 3 upvotes · 0 comments
- [GCC 17 Lands Initial Infrastructure For C\+\+29](https://daily.dev/posts/gcc-17-lands-initial-infrastructure-for-c-29-88nwgk4k0) · Phoronix · 0 upvotes · 0 comments
- [Defer in Swift explained with Code Examples](https://daily.dev/posts/defer-in-swift-explained-with-code-examples-h9vthjklz) · SwiftLee · 1 upvotes · 0 comments
- [December 22, 2025](https://daily.dev/posts/december-22-2025-axw3bxadg) · Hacker News · 2 upvotes · 0 comments

---

Tags: [#c](https://daily.dev/tags/c)

[View this post on daily.dev](https://daily.dev/posts/defer-available-in-gcc-and-clang-2as4i32ce)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Defer available in gcc and clang","url":"https://daily.dev/posts/defer-available-in-gcc-and-clang-2as4i32ce","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/defer-available-in-gcc-and-clang-2as4i32ce"},"datePublished":"2026-02-16T00:05:49.862Z","dateModified":"2026-02-16T00:06:10.230Z","description":"The defer feature for C is now available in gcc and clang compilers, following the completion of ISO Technical Specification 25755. Starting with clang-22 and...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/3d7d4638f646786438def582aea2b36a?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/3d7d4638f646786438def582aea2b36a?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Lobsters","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Lobsters","logo":"https://media.daily.dev/image/upload/s--tl8v_Fku--/f_auto,t_logo/v1698841318/logos/lobste.jpg","url":"https://daily.dev/sources/lobsters"},"commentCount":1,"discussionUrl":"https://daily.dev/posts/defer-available-in-gcc-and-clang-2as4i32ce","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":8},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":1}],"keywords":"c","timeRequired":"PT4M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Lobsters","item":"https://daily.dev/sources/lobsters"},{"@type":"ListItem","position":3,"name":"Defer available in gcc and clang"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/defer-available-in-gcc-and-clang-2as4i32ce","comment":[{"@type":"Comment","text":"Nice, it only took 50 years and another 25 for wide adoption.","datePublished":"2026-02-20T18:10:22.462Z","url":"https://daily.dev/posts/2As4I32Ce#c-NNJi5jalS","author":{"@type":"Person","name":"Isaac de Andrade","url":"https://daily.dev/andradei","image":"https://avatars.githubusercontent.com/u/2653546?v=4"}}]}
```

