News for hackers. Stuff that matters.
Re:Current hardware trends make C++ exceptions harder to jus... by _b on Tuesday February 22, 2022 @01:57PM (#30431982)
Don't write constructors that can fail unless it is failure that would be appropriate to crash for. That works out a lot better than it might naively sound. It is hard for people to reason about the possibility of constructors/destructors failing, so actually rather nice to just forbid it.
Re:Current hardware trends make C++ exceptions harder to jus... by addaon on Tuesday February 22, 2022 @02:02PM (#30432073)
And for those super-rare cases where it's appropriate to crash / fail hard in a constructor but you still have requirements about reporting or even recovery... setjmp/longjmp still exist.
Re:Current hardware trends make C++ exceptions harder to jus... by ncmncm on Tuesday February 22, 2022 @02:43PM (#30432639)
You have always had the choice available to do something overwhelmingly worse than throwing. That is not a reason to do it.