-
Notifications
You must be signed in to change notification settings - Fork 40
err: Implement basis for new error API #83
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
Conversation
source/deimos/openssl/err.d
Outdated
auto ERR_raise_data () ( | ||
string file = __FILE__, int line = __LINE__, string func = __FUNCTION__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signature in docs seems to be:
void ERR_raise_data(int lib, int reason, const char *fmt, ...);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh that's sneaky:
https://github.com/openssl/openssl/blame/4d346a188c27bdf78aa76590c641e1217732ca4b/include/openssl/err.h.in#L379-L382
Good thing we deprecated the comma operator for such code.
Hum I don't think the FILE/LINE/FUNC thing can work with the same API. |
@CyberShadow : Updated. Not found of the API, but it's the only one that provides the same functionality (automatic file / line / func). Any suggestion / idea ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I think an alternative which would be closer to the C macros would be to make ERR_raise_data
a @property
function which returns &ERR_set_error
. Then, ERR_raise_data
wouldn't need to copy ERR_set_error
's signature.
But it wouldn't get rid of the template bloat, which is my main concern. Also I don't think it works: import std.stdio;
void main ()
{
ERR_raise_data(42, 69, "Hello World");
}
@property auto ERR_raise_data () ()
{
return &ERR_set_error;
}
void ERR_set_error(int lib, int reason, string fmt)
{
writeln(fmt, " -- ", lib, " -- ", reason);
}
You'll need two sets of parenthesis which IMO is not worth the cost for the benefit of avoiding duplication. YMMV. |
Right, I forgot properties are useless :( I don't think you can do better without requiring object files. |
Fairly straightforward, didn't cover the full header though.