(Un)portable defer in C

C 언어에서 자원 해제를 자동화하는 defer 기능은 여러 제안과 구현이 존재하지만 표준으로 채택되지는 않았다. GCC의 cleanup 속성과 nested function, Clang의 blocks, MSVC의 structured exception handling 등 각 컴파일러별로 다른 방식으로 구현 가능하나, 보안 문제나 호환성 한계가 있다. 간단한 for 루프나 스택 기반 구현도 있지만 조기 종료 시 동작 보장이 어렵거나 별도의 반환 매크로 사용이 필요하다. C23 표준에 defer가 포함될 가능성이 있으나, 현재는 컴파일러별 트레이드오프를 고려해 선택해야 한다.

https://antonz.org/defer-in-c/

#cprogramming #defer #gcc #clang #memorymanagement

(Un)portable defer in C

Eight ways to implement defer in C.

I think this is pretty neat, and a bit different than most c-style language implementations: any number of initial arguments can be factored out of a group of functions:

https://mocompute.codeberg.page/item/2026/2026-05-08-tess-receiver-blocks.html

#c #programming #programminglanguages #cprogramming #compiler

Tess receiver blocks: reduce visual noise in API headers

Finally finished a post with some initial motivations and reflections about a programming language project I've been working on for nearly the past year: https://mocompute.codeberg.page/item/2026/2026-04-26-practical-additions-to-c.html #c #programming #programminglanguages #cprogramming #compiler
Tess Language: A minimal set of practical additions to C

Embedded Rust or C Firmware? Lessons from an Industrial Microcontroller Use Case

https://arxiv.org/abs/2604.25679

#HackerNews #EmbeddedRust #CProgramming #Microcontrollers #FirmwareDevelopment #IndustrialTech

Embedded Rust or C Firmware? Lessons from an Industrial Microcontroller Use Case with Ariel OS

As Rust gains traction for developing safer systems software, a reality check for the microcontroller hardware segment becomes necessary. How ready is the Rust ecosystem for this segment? Can Rust compete with C in practice? This paper reports on an IoT industrial case study that contributes to answering these questions. Two teams concurrently developing the same functionality (one in C, one in Rust) are analyzed over a period of several months. A comparative analysis of their approaches, results, and iterative efforts is provided. The analysis and measurements on hardware indicate no strong reason to prefer C over Rust for microcontroller firmware on the basis of memory footprint or execution speed. Furthermore, Ariel OS is shown to provide an efficient and portable system runtime in Rust whose footprint is smaller than that of the state-of-the-art bare-metal C stack traditionally used in this context. It is concluded that Rust is a sound choice today for firmware development in this domain.

arXiv.org

Lib0xc: A set of C standard library-adjacent APIs for safer systems programming

https://github.com/microsoft/lib0xc

#HackerNews #Lib0xc #CProgramming #SaferSystems #APIs #Microsoft

GitHub - microsoft/lib0xc: Safe(ish) C programming library

Safe(ish) C programming library. Contribute to microsoft/lib0xc development by creating an account on GitHub.

GitHub
So, you thought passing too few register parameters to a C function was a good idea? 🤔 Surprise! Now you're knee-deep in a jargon soup of Microsoft Dev Blogs trying to untangle your mess. 🥴 But hey, at least you've got a PhD in reading buzzwords now! 🎓
https://devblogs.microsoft.com/oldnewthing/20260427-00/?p=112271 #CProgramming #JargonSoup #MicrosoftDevBlogs #DeveloperHumor #CodingStruggles #PhDInBuzzwords #HackerNews #ngated
Looking at consequences of passing too few register parameters to a C function on various architectures - The Old New Thing

It's bad news no matter how you slice it, but Itanium makes it even worse.

The Old New Thing
Looking at consequences of passing too few register parameters to a C function on various architectures - The Old New Thing

It's bad news no matter how you slice it, but Itanium makes it even worse.

The Old New Thing
CJIT

C, Just in Time!

Why C Remains the Gold Standard for Cryptographic Software - wolfSSL

For production cryptographic software, memory safety alone does not define security. Real-world crypto must run on every platform, maintain stable assumptions

wolfSSL
Ah yes, the thrilling world of #FilC, where we simplify a "memory safe" version of C by rewriting everything with the grace of a toddler with finger paints. 🎨💻 Because nothing says #innovation like rehashing old concepts with more buzzwords than a Silicon Valley power lunch. 🚀
https://www.corsix.org/content/simplified-model-of-fil-c #MemorySafety #CProgramming #TechBuzz #HackerNews #ngated
A simplified model of Fil-C