Skip to content

Conversation

@elbeno
Copy link
Contributor

@elbeno elbeno commented Nov 3, 2025

Problem:

  • Sometimes it is useful to use fields that overlap: for instance to be able to inspect individual bits and have an overlapping field that represents the set of bits as a whole. In these cases it is useful at construction time to leave such an overlapping field uninitialized so that we don't have a scenario where one initialization overwrites another.

Solution:

  • Allow a field to be marked as uninitialized so that on construction it won't potentially clobber other fields.

Note:

  • The difference between without_default and uninitialized is that a field marked without_default must still be given a value at construction time.

Problem:
- Sometimes it is useful to use fields that overlap: for instance to be able to
  inspect individual bits _and_ have an overlapping field that represents the
  set of bits as a whole. In these cases it is useful at construction time to
  leave such an overlapping field uninitialized so that we don't have a scenario
  where one initialization overwrites another.

Solution:
- Allow a field to be marked as `uninitialized` so that on construction it won't
  potentially clobber other fields.

Note:
- The difference between `without_default` and `uninitialized` is that a field
  marked `without_default` must still be given a value at construction time.
@elbeno elbeno merged commit 7ec29db into intel:main Nov 3, 2025
33 checks passed
@elbeno elbeno deleted the uninit-field branch November 3, 2025 17:33
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

Successfully merging this pull request may close these issues.

2 participants