Skip to content

[trivial] silence the warning about this pointer#635

Merged
Yurlungur merged 2 commits intomainfrom
jmm/some-casts
Apr 14, 2026
Merged

[trivial] silence the warning about this pointer#635
Yurlungur merged 2 commits intomainfrom
jmm/some-casts

Conversation

@Yurlungur
Copy link
Copy Markdown
Collaborator

PR Summary

Tiny, trivial change. It is safe to copy the this pointer in variant, due to how the recursive serialization routines work. However, C++20 warns. This makes the compiler happy.

PR Checklist

  • Adds a test for any bugs fixed. Adds tests for new features.
  • Format your changes by using the make format command after configuring with cmake.
  • Document any new features, update documentation for changes made.
  • Make sure the copyright notice on any files you modified is up to date.
  • After creating a pull request, note it in the CHANGELOG.md file.
  • LANL employees: make sure tests pass both on the github CI and on the Darwin CI
  • If ML was used, make sure to add a disclaimer at the top of a file indicating ML was used to assist in generating the file.
  • If Agentic AI was used, have the AI generate a "proposed changes" markdown file and store it in the plan_histories folder, with a filename the same as the MR number.

If preparing for a new release, in addition please check the following:

  • Update the version in cmake.
  • Move the changes in the CHANGELOG.md file under a new header for the new release, and reset the categories.
  • Maintainers: ensure spackages are up to date:
    • LANL-internal team, update XCAP spackages
    • Current maintainer of upstream spackages, submit MR to spack

@Yurlungur Yurlungur self-assigned this Apr 13, 2026
@Yurlungur Yurlungur added the clean-up Changes that don't affect code execution but make the code cleaner label Apr 13, 2026
Copy link
Copy Markdown
Collaborator

@buechlerm buechlerm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we know that copying the raw bytes into the object here is safe because you wrote it all (and the target is effectly empyt at this point), but is there an approach that guarantees safety, or is this a case where this operation can only be written with that knowledge. To be clear, I'm not asking you to do anything different, just trying to learn.

@Yurlungur
Copy link
Copy Markdown
Collaborator Author

So we know that copying the raw bytes into the object here is safe because you wrote it all (and the target is effectly empyt at this point), but is there an approach that guarantees safety, or is this a case where this operation can only be written with that knowledge. To be clear, I'm not asking you to do anything different, just trying to learn.

Copying is safe because we "fill in" after. So we want to use memcpy to copy the top-level structure of the struct. The pointers will be invalid after memcpy in the serialized data structure. But the data will be copied in after the struct body. Then after deserialization, the pointers are assigned properly.

@Yurlungur
Copy link
Copy Markdown
Collaborator Author

Waiting for the final tests to pass. They're stuck in the queue right now.

@Yurlungur Yurlungur merged commit 09d860a into main Apr 14, 2026
9 checks passed
@Yurlungur Yurlungur deleted the jmm/some-casts branch April 14, 2026 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clean-up Changes that don't affect code execution but make the code cleaner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants