News for hackers. Stuff that matters.
Re:Current hardware trends make C++ exceptions harder to jus... by HelloNurse on Tuesday February 22, 2022 @02:21PM (#30432315)
If the program fails too often or too unfairly, why should you blame how such failures are handled? The only reasonable "probabilistic estimation" is that something that happens 10% of the time is normal and it shouldn't be treated as an "exception", even if actually thrown exceptions were fast.
Re:Current hardware trends make C++ exceptions harder to jus... by masklinn on Tuesday February 22, 2022 @02:27PM (#30432422)
> If the program fails too often or too unfairly, why should you blame how such failures are handled?

Because the discussion is about methods of reporting and handling failure?

> The only reasonable "probabilistic estimation" is that something that happens 10% of the time is normal and it shouldn't be treated as an "exception"

That makes no sense whatsoever, and doesn't address the question.

And even if a ctor fails at a rate of 0.9, it has to report errors via exceptions, because that's the only mechanism available to ctors.

Re:Current hardware trends make C++ exceptions harder to jus... by im3w1l on Tuesday February 22, 2022 @02:47PM (#30432696)
You could use an output pointer parameter. You could construct an object which self-reports as invalid. You could take an error handler callback. You could use a global variable.

Or I think my preference would be a private constructor, and a friend-function that returns value-or-error.