Is it good programming practice to use setjmp and longjmp in C?

前端 未结 8 1894
误落风尘
误落风尘 2021-02-07 10:28

I\'m a C++ programmer and used to OO languages with good exception handling.

From what I can understand, setjmp and longjmp are essentially a c-style way to propogate ex

8条回答
  •  礼貌的吻别
    2021-02-07 11:01

    Apart from the answers posted so far, I would like to add that the setjmp in C allow the implementation of tail recursiveness in an elegant way.

    So yes, not only it's a good practice but this is the only portable elegant way to do some things in C.

提交回复
热议问题