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

Move reinterpret_cast<> calls into MAKE_*_API macros in C layer #316

Open
billschereriii opened this issue Mar 20, 2023 · 0 comments
Open
Labels
area: C Issues related to the C client type: refactor Issues focused on refactoring existing code

Comments

@billschereriii
Copy link
Contributor

Description

We have a consistent handling of the way we translate from the C-layer void* to the C++ objects in each of the C layer API methods, so it should be possible to unify this handling and hide it inside the template, further reducing the LOC in the interface

Justification

More standardization improves maintenance

Implementation Strategy

The arguments to the template's lambda function capture might be able to include a reinterpret_cast of the void* object passed in from C. This would requires consistent naming and for the name in the capture to not be evaluated until the capture is performed (which may be inconsistent with C++ specs, in which case this won't work at all). If it does work, it's a relatively simple way to eliminate another hundred lines or so of code from the C interface layer.

@billschereriii billschereriii added type: refactor Issues focused on refactoring existing code area: C Issues related to the C client labels Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: C Issues related to the C client type: refactor Issues focused on refactoring existing code
Projects
None yet
Development

No branches or pull requests

1 participant