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

result::Element contains potentially redundant pointer information #380

Open
JakeHillion opened this issue Oct 10, 2023 · 0 comments
Open
Assignees

Comments

@JakeHillion
Copy link
Contributor

There are two fields in Element that are potentially redundant. We have pointer, an optional uintptr_t, and data which is a variant potentially containing a struct Pointer { uintptr_t p; };.

std::optional<uintptr_t> pointer;
std::variant<std::nullopt_t, Pointer, Scalar, std::string> data = {
std::nullopt};

The question of which field is better depends on if we want to be able to store field data as well as pointer data. I suspect that we might for memory layout data along with value capture. In that case, we should probably remove the pointer field from the data variant and set pointer itself instead. If we never need both data and a pointer, we could drop the pointer field and always use the variant.

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