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

Explore how to return consistent missing values in C++ (instead of -1) #22

Open
apulsipher opened this issue Oct 14, 2024 · 1 comment
Milestone

Comments

@apulsipher
Copy link

apulsipher commented Oct 14, 2024

Ref: #21 (comment)

@gvegayon gvegayon added this to the Sprint 1 milestone Oct 14, 2024
@IsaccBarker
Copy link

IsaccBarker commented Oct 26, 2024

I'm still not entirely clear on what the problem is here, since the -1 figure should never occur naturally and is able to be filtered out by the caller. Nevertheless, the way I see it, we have a few options:

  • Change the type of gentimes (currently standing at std::vector<int>) to be a vector of a sum type which is able to be matched against. This would force the aforementioned filtering (if you wanted to do anything useful with the number inside, at least), but would disrupt both API congruency and stability. There's also the boilerplate to consider.

  • Keep the return type the same, and just return a signal so far out of left field (probably INT_MIN/-2147483648) that any resulting figures are obviously erroneous. This would keep the API the same and reduce boilerplate, but wouldn't require filtering (whether this last point is a good or bad thing has yet to be decided, I think).

Thoughts?

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

3 participants