I linked my Snow testing library here on lobste.rs two days ago, and got a ton of great feedback, a lot of which I have incorporated into the library.
I figured it would be fun to write up some of the more obscure C features I learned about while writing the library.
GCC has a cleanup attribute that may be useful.
related, this is an implementation of Andrei Alexandrescu’s SCOPE_EXIT (pretty much the same as defer in go) with gcc’s cleanup attribute and with clang blocks
gcc’s version is cleaner and has no runtime overhead, gcc is able to optimize all of the complexity away in that simple case (usually also in more complex cases too)
“Yes, the somelabel is a void *. Yes, we dereference somelabel to go to it. I don’t know how that works, but the important part is that it does”
Well it is a pointer of type void, and you are not interested in its address but the addres it holds. If that’s weird, ever thought of char*s?