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

前端 未结 8 1897
误落风尘
误落风尘 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:02

    You should have brought up the issue that goto and maybe longjmp are not good before Exception handling (Try+catch+finally+..) became popular (using longjmp). If people can't handle a sparse usage of goto to make things easier then how can they handle all of the permutations of logic bypassed by the longjmp exception handling and then continue on like nothing happened? The real issue is people are looking for rules instead of concepts.

提交回复
热议问题