Skip to content

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

@lukevalenty

Description

@lukevalenty

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.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions