-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
An exceptionless version that does not throw? #134
Comments
I came up with another solution that does not change the library as much, here is how it works: When a macro TOML_NO_EXCEPTIONS is defined, the regular toml::exception does not inherit from std::exception, and the rest of the exception types will inherit from a virtual class that provides the same virtual functions so that everything just works.
For places that throw exceptions, if the macro is defined, the functions will have an extra parameter at the end that returns the exception object instead of it being thrown, the rest of the code is the same.
|
I have been interested in this topic. My plan is to use In my plan, the interface would look like the following. I want to have some space to extend it more later, having toml::parse(std::string filename, toml::option<...> opt = toml::option<>{}); Main concern is compilation speed and backward compatibility. I will try to reduce compilation overhead and to minimize the difference from the current version, but it is a hard task. Firstly, I need to find a solid blocks of time to focus on it. (Strictly speaking, making |
there is a version of new that does not throw and instead returns nullptr on failure, https://en.cppreference.com/w/cpp/memory/new/nothrow And yes, i'm talking about exceptions that are caused by syntax errors. |
Is there any interest in having a version of the library that does not throw exceptions everywhere?
If yes, how would the API for such thing look like?
Example: this will add an extra parameter at the end of function definitions which could be default initialized so it does not require changes to existing code:
and TomlError is defined such that:
Looking forward for your opinion on this.
The text was updated successfully, but these errors were encountered: