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

🎇 cib::service pointers should be constinit initialized to a default function pointer or type #665

Closed
lukevalenty opened this issue Dec 31, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@lukevalenty
Copy link
Contributor

There are some unfortunate cases in which a cib::service pointer may not be initialized. If it is later used, UB is invoked and it becomes very difficult for a library user to understand what is going on. This happens if nexus.init() is never called, or if a non-existent service is called through cib::service.

We can't check this at compile-time, but we can ensure that each cib::service pointer dereferenced is constinit initialized to a default implementation that logs an error when called. For the flow library, this would simply be a function pointer that logs an error saying the given flow was never added to the nexus.

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

No branches or pull requests

2 participants