Re:Let's write a setjmp
by pm215 on Sunday February 12, 2023 @04:14AM
(#34761317)
Mostly for the usual "don't reinvent a wheel the language standard library already provides" reasons, I think. For instance glibc's x86setjmp/sigsetjmp have been updated to support shadow stacks, but if you'd rolled your own you'd have to do that yourself:
https://elixir.bootlin.com/glibc/glibc-2.35/source/sysdeps/i...
[ Parent
| on HN ]
Yes, but the author was trying to avoid using libc.
> Yesterday I wrote that setjmp is handy and that it would be nice to have without linking the C standard library.
Related article from the same author. https://nullprogram.com/blog/2023/02/11/
Personally I think that's throwing the baby out with the bathwater for most use cases. You could rephrase my comment as "if you're already committed to reinventing half of libc's wheels, this one is not really any harder or more awkward than most, but if you're not aiming for that overall goal then reinventing just this one wheel is a bad plan" if you like.