News for hackers. Stuff that matters.
Re:Hello, PNG by mjburgess on Wednesday January 18, 2023 @10:21AM (#34427695)
Are there reasons to interpret `setjmp` and `longjmp` as anything other than a `C` (/hardware) representation of Effects? (In the sense of exceptions, coroutines/await, etc.)

If so, then why aren't they fundamentally quite reasonable?

Re:Hello, PNG by flohofwoe on Wednesday January 18, 2023 @11:10AM (#34428524)
Some platforms don't support full setjmp/longjmp feature set (WASM for instance). As far as I'm aware libpng also works without setjmp/longjmp support though via a build config option (it's still not fun to integrate into a project if you need to build it from source).
Re:Hello, PNG by keyneus on Wednesday January 18, 2023 @01:38PM (#34430915)
As of libpng 1.6.0, a so-called "simplified API" was added, which does not use setjmp/longjmp. A while back I had a C project using the old API, and I converted it to C++, and the interaction of setjmp/longjmp with exceptions was giving me headaches. I switched to the simplified API, and it was a breeze. So much less code, and no hacky C "exceptions". If you can require libpng 1.6 or newer, it's worth looking at the simplified API, if it supports your needs.

It's described here: http://www.libpng.org/pub/png/libpng-manual.txt