4 ms·
> I'm pretty sure that C++ exceptions could be simulated that way. Indeed they can, may I introduce you to the preprocessor/macro extravaganza that is libextc:
by mitchty 12y ago
> I'm pretty sure that C++ exceptions could be simulated that way.
Indeed they can, may I introduce you to the preprocessor/macro extravaganza that is libextc:
https://github.com/jspahrsummers/libextc/blob/master/src/exception.c https://github.com/jspahrsummers/libextc/blob/master/src/exc...
I used it for a bit mostly to learn the chicanery of the madness. But I'm not a huge exception fan in general it just doesn't fit C well in my opinion.
- mtdewcmu 12y agoI've never seen much value in exceptions. For that matter, I've never had much interest in using longjmp and setjmp. It's possible that I tried them out at one point just to see them work. But I've never come up with a use for them.
- mitchty 12y agoWell if you try using setjmp/longjmp and then introduce threads with this stuff, I think you'll quickly realize where this whole rigamarole breaks down. I gave it a quick try but honestly its simpler to just use straightforward C.
- mtdewcmu 12y agoI admire your persistence and tenacity in getting as far as you did with that rigamarole. I'll take your word for it that it that it ends badly. :)
- mitchty 12y agoHeh thanks, it was more along the lines of: well i've never tried to get set/longjmp to work with threads, how hard can it be? Short answer, harder than you'd initially think. So many edge cases, the horror.
- mtdewcmu 12y agoIt seems like someone must have done it, if doing it is at all worthwhile...