-
Notifications
You must be signed in to change notification settings - Fork 30
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
throw exception on C_NULL return from GSL allocation functions #9
Comments
I can certainly modify the |
Probably the best thing is to register a GSL error handler that throws an exception. Then you won't need to check the return values at all. In fact, because looking more closely at the GSL manual, it seems that GSL calls The following code creates an error handler that converts a GSL error into a corresponding Julia exception and throws it:
For example, if you do:
without the error handler above, then GSL aborts (i.e. crashes the program) with the message (It's not completely clear to me if we want to throw an You can just insert the above code into one of the |
This looks great, I'll put it in |
When a GSL allocation function (one of the many functions that returns a pointer to an opaque pointer) returns
C_NULL
, an exception (whose type is determined by checking thegsl_errno
global variable) should be thrown.The text was updated successfully, but these errors were encountered: