# GCC 17 Kills Trampolines: Nested Functions with Capture Now Trampoline-Free

Original title: Using GCC's Nested Functions with Wide Pointers and No Trampolines II

> Hacker News story 49308685 · language: en · submitted 2026-08-15
> Web version: https://zeli.app/story/49308685
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 100 · by [uecker](<https://news.ycombinator.com/user?id=uecker>) · 💬 47
[original](<https://uecker.codeberg.page/2026-07-14.html>) · [HN discussion](<https://news.ycombinator.com/item?id=49308685>)

## Summary

GCC 16 guarantees that nested functions not capturing parent variables avoid trampolines, and GCC 17 adds built-ins to eliminate trampolines even for capturing functions. This enables safe, efficient nested function calls with wide pointers, as demonstrated by a simple example that compiles to a single instruction.

## Key quote

> In fact, with trampolines out of the picture, all that GCC does under the hood is to automatically transform this into the example above!

## HN discussion (47 comments)

### [mbeavitt](<https://news.ycombinator.com/item?id=49309818>)

> Why would someone want to use a nested function, practically speaking?

### [mananaysiempre](<https://news.ycombinator.com/item?id=49309524>)

> What about your older patch where -fno-trampolines meant a function pointer could either be a code pointer or a closure (descriptor) pointer, distinguished by a tag?

### [tpoacher](<https://news.ycombinator.com/item?id=49309757>)

> What's a "trampoline"?

---

## Cite

- Page: https://zeli.app/story/49308685
- Date: 2026-08-15
- Source: uecker.codeberg.page (https://uecker.codeberg.page/2026-07-14.html)
- Hacker News: https://news.ycombinator.com/item?id=49308685

## Other languages

- zh: https://zeli.app/zh/story/49308685 · markdown: https://zeli.app/zh/story/49308685.md
- ja: https://zeli.app/ja/story/49308685 · markdown: https://zeli.app/ja/story/49308685.md
- ko: https://zeli.app/ko/story/49308685 · markdown: https://zeli.app/ko/story/49308685.md
- de: https://zeli.app/de/story/49308685 · markdown: https://zeli.app/de/story/49308685.md
- es: https://zeli.app/es/story/49308685 · markdown: https://zeli.app/es/story/49308685.md
