jamesdbrock / hffix

Financial Information Exchange Protocol C++ Library
http://jamesdbrock.github.io/hffix
Other
276 stars 89 forks source link

Exception free error handling #49

Open alfred-666 opened 1 year ago

alfred-666 commented 1 year ago

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

jamesdbrock commented 1 year ago

Yes, I agree.

jamesdbrock commented 1 year ago

What do you think this would look like, ideally?

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

alfred-666 commented 1 year ago

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

jamesdbrock commented 1 year ago

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?

alfred-666 commented 1 year ago

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.