-
Notifications
You must be signed in to change notification settings - Fork 1
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
tagvalue null pointer #33
Comments
currently there are |
I will note that How do you feel about exceptions/errors ? ppl writing ultra high performance code tend to avoid , and other parts of our library and codebases are |
My expectation was that the library user should make the check. In some cases a bam may always have a tag they are looking for. With that in mind we could avoid a branch from the check. Exceptions are nice for opening and closing files with dhtslib but I prefer performance where it can be gained. Though I have a more intimate understanding of some of htslib's inner workings than a user might. We could always make such checks debug only as with D the assumption is that you will test your code in debug mode and things such as array out of bounds checks are removed in production. |
…lso closing #33 as discussion has ended
After a lot of thought I want to reopen this. We don't have to fix right away, or even decide right away, but the appearance of a null-pointer which is dependent on specific user input (i.e., the bamfile) is very dangerous and may never be caught by a developer during testing. As Rust has shown us, safety does not have to come with much or any speed penalty, and overall CPUs these days are excellent at branch prediction What do you think about wrapping it in Nullable or something along those lines? |
A fair point, and a decent idea. Will have to find a nullable to use though. I think the dlang Nullable is rather new? I don't want to hold the library back by requiring a high dlang library version requirement. |
Also currently we don't have any external library deps -- only the stdlib -- that is a huge plus IMO. That being said, there are several nullable implementations phobos https://dlang.org/phobos/std_typecons.html |
… safety, added rc, fixed toString, added more unittesting, addresses #33 though likely causes a performance deficit (should revisit with an Optional type)
Commit 4f5a29c introduces |
With the closing of #66 and the prior mentioned commit, |
bam_aux_get may return nullpointer; ctor checks for this, but the other member functions (
to
, etc.) do not. they must check for null pointer (or will segfault), or else the ctor should allocate (probably a bad idea)The text was updated successfully, but these errors were encountered: