Skip to content
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

Several functions give runtime not-implemented errors #39

Open
kunaltyagi opened this issue Feb 13, 2018 · 2 comments
Open

Several functions give runtime not-implemented errors #39

kunaltyagi opened this issue Feb 13, 2018 · 2 comments

Comments

@kunaltyagi
Copy link
Contributor

It's preferable to have compile time errors than to have runtime errors. Lots of classes which act as pure virtual in BFL instead are just virtual. The relevant functions have a ```cerr`` with exit which doesn't make sense specially with C++.

I propose we make such functions pure virtual.

@toeklk
Copy link
Collaborator

toeklk commented Feb 20, 2018

Agree, AFAICT only the following files are affected

pdf/analyticconditionalgaussian.cpp: exit(-BFL_ERRMISUSE);
pdf/filterproposaldensity.cpp: exit(-BFL_ERRMISUSE);
pdf/pdf.h: exit(-BFL_ERRMISUSE);
pdf/pdf.h: exit(-BFL_ERRMISUSE);
pdf/pdf.h: exit(-BFL_ERRMISUSE);
pdf/pdf.h: exit(-BFL_ERRMISUSE);

@kunaltyagi
Copy link
Contributor Author

Making them pure virtual would impact several child classes of pdf. However, we should be able to push error code to them making it clearer to the user in case of run-time error.

Prediction: Would impact almost the entire pdf section of bfl, rewriting ~10-20% of code in this section.
Benefit: once the functions are pure virtual, no need of dynamic_cast making filters easier to implement

If we were to do this large refactor, we might want to look into addressing concerns of

  • Real Time usage
  • Thread safety
  • Memory ownership

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants