hffix icon indicating copy to clipboard operation
hffix copied to clipboard

Exception free error handling

Open alfred-666 opened this issue 2 years ago • 7 comments

Some environments don't have luxury of exception so having exception free code paths would be great

alfred-666 avatar Jul 21 '23 12:07 alfred-666

Yes, I agree.

jamesdbrock avatar Jul 28 '23 14:07 jamesdbrock

What do you think this would look like, ideally?

Would you use a lot of std::variant return types? Or std::expected?

jamesdbrock avatar Jul 30 '23 19:07 jamesdbrock

I actually like std::expected but its C++23 which is really std:: variant underneath.

Maybe we can fallback to https://github.com/TartanLlama/expected

alfred-666 avatar Jul 30 '23 19:07 alfred-666

Yeah, std::expected would be ideal.

hffix currently has two properties which I like to preserve, if possible:

  1. C++ language requires only C++98.
  2. No dependencies except the standard library.

But maybe it's time to start relaxing these requirements.

May I ask, what is your build environment? You have C++23 but you don't have exceptions?

jamesdbrock avatar Jul 31 '23 13:07 jamesdbrock

we can keep both of the requirements by bundling the above library in the source code. it's header only so i don't expect any issues.

I have C++20 with exception disabled because of hard latency requirements.

alfred-666 avatar Jul 31 '23 14:07 alfred-666