Re:Show HN: Automatic cleanup in C using with-statements
by taeber on Monday June 01, 2020 @09:30AM
(#23378189)
Yes you can. I did mention GCC's cleanup attribute along with MSVC's try-finally construct. Another user was kind enough to even provide an example in their GitHub issue: https://github.com/taeber/cwith/issues/1.
Re:Show HN: Automatic cleanup in C using with-statements
by kettro on Monday June 01, 2020 @04:04AM
(#23376267)
Macros are the lifeblood of embedded C. I have a use case where I need to read, shift, and OR a value, then write back. If I need to do that for more than 1 thing, sure as shit I'll write a macro.
https://www.reddit.com/r/embedded/comments/gt8vsc/using_raii...
Reminds of the old adage - You never code in plain C, you need to first #define some macros and then you can proceed with metaprogramming
You think those GPIO registers are going to encode themselves?