WeSearch

Using GCC's nested functions with wide pointers and no trampolines

·7 min read · 0 reactions · 0 comments · 11 views
#gcc#programming#nested functions
⚡ TL;DR · AI summary

The article discusses the use of nested functions in GCC with wide pointers and without trampolines. It highlights the advantages of nested functions for accessing local state and the challenges posed by traditional trampoline implementations. The author proposes alternative solutions using wide pointers and function descriptors to improve efficiency and security.

Key facts
Original article
Codeberg
Read full at Codeberg →
Opening excerpt (first ~120 words) tap to expand

hljs.initHighlightingOnLoad(); Using GCC's Nested Functions with Wide Pointers and no Trampolines Martin Uecker, 2026-01-06 Introduction Nested functions are extremely useful, which is why basically any computer language since ALGOL60 has them. Except C. In particular, nested functions are useful to write kernels for passing them to higher-order functions. The kernels can access local state, and this is important because it then does not have to be passed as a void pointer to the higher-order function. void tree_increase_all(tree(int) *t, int increment) { void update(int *value) { (*value) += increment; } tree_walk(t, update); } For very simply nested functions it makes also sense to use a lambda expression, i.e. an anonymous nested function.

Excerpt limited to ~120 words for fair-use compliance. The full article is at Codeberg.

Anonymous · no account needed
Share 𝕏 Facebook Reddit LinkedIn Threads WhatsApp Bluesky Mastodon Email

Discussion

0 comments

More from Codeberg