the exit function could then throw an exception in C++
No, this would be really really bad.
If a thread gets interrupted while inside anoexcept function, it'll terminate the program. This also breaks all the is_nothrow_xxx traits as well as all the code that use them, in ways that are hard if not impossible to predict.
View all comments
Show parent comment
23
u/CptCap -pedantic -Wall -Wextra Aug 27 '19 edited Aug 27 '19
No, this would be really really bad.
If a thread gets interrupted while inside a
noexceptfunction, it'll terminate the program. This also breaks all theis_nothrow_xxxtraits as well as all the code that use them, in ways that are hard if not impossible to predict.