
Show HN: Automatic cleanup in C using with-statements - taeber
https://github.com/taeber/cwith
======
spacedcowboy
Or you could use attributes...

[https://www.reddit.com/r/embedded/comments/gt8vsc/using_raii...](https://www.reddit.com/r/embedded/comments/gt8vsc/using_raii_in_c_for_fun_and_profit/)

~~~
taeber
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](https://github.com/taeber/cwith/issues/1).

------
NullPrefix
Hey, it's pretty nice.

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

~~~
mycall
Unless you are doing embedded programming.

~~~
asguy
Especially when you are doing embedded programming.

You think those GPIO registers are going to encode themselves?

