Skip to content

result::Element contains potentially redundant pointer information #380

@JakeHillion

Description

@JakeHillion

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.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions