Merged
Conversation
…r of calling assignment operator on uninitialized memory
Member
Author
|
oh and as expected this also fixes issues for me that I saw on |
Merged
4 tasks
emilk
approved these changes
Oct 20, 2023
| new (&self._data.many_optional) TypeAlias(std::move(many_optional)); | ||
| new (&self._data.many_optional | ||
| ) std::optional<std::vector<rerun::datatypes::AffixFuzzer3>>(std::move(many_optional | ||
| )); |
Member
Author
There was a problem hiding this comment.
it's just a test and it wasn't me, it was clang format :D ;)
Wumpf
added a commit
that referenced
this pull request
Oct 23, 2023
…g on ctor/assignment (#3936) ### What⚠️ for ease of conflict avoidance use based on #3935 _Clarification: This PR is mostly scratching an itch of mine & addresses (in my experience) mostly aesthetic problems_ Using std::array makes a bunch of codegen things easier. This in turn made it easy to revisit how parameters are passed on constructors. --- Previous rationale on now discarded "more like cpp guidelines" approach: This follows now the usual "common sense" logic that I believe people expect from C++ constructors: * primitive type, no array: pass by value, copy * primitive type, fixed size array: pass by const&, copy * anything that is movable: pass by value, move The latter one is what we had exclusively before. It's less common in the wild which is why codegen has a bit of rationale in the comments about it. You might say: "But @Wumpf! Passing large fixed size arrays or structs not by value is important as it avoids a copy, this isn't just aesthetic!". My reply being that from a language lawyer perspective this might be true, but practically there is no such thing as passing structs by value as [calling conventions](https://learn.microsoft.com/en-us/cpp/build/x64-calling-convention?view=msvc-170#parameter-passing) will almost _always_ force (sufficiently large) structs to be passed by reference (with some exceptions to the rule to be fair). Meaning the compiler has a _very_ easy time to optimize both caller and callee even without any inlining what-so-ever ... but I digress... ;) ### Checklist * [x] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md) * [x] I've included a screenshot or gif (if applicable) * [x] I have tested [demo.rerun.io](https://demo.rerun.io/pr/3936) (if applicable) * [x] The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG - [PR Build Summary](https://build.rerun.io/pr/3936) - [Docs preview](https://rerun.io/preview/bc4dd6a959cafd47b49230b00586d554c2e57208/docs) <!--DOCS-PREVIEW--> - [Examples preview](https://rerun.io/preview/bc4dd6a959cafd47b49230b00586d554c2e57208/examples) <!--EXAMPLES-PREVIEW--> - [Recent benchmark results](https://ref.rerun.io/dev/bench/) - [Wasm size tracking](https://ref.rerun.io/dev/sizes/) --------- Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
code-examples/transform3d_simple) #3865It seems this was caused by undefined behavior via calling an assignment operator on uninitialized memory!
Bulldozered the entire responsible codegen section over to make it super simple :)
(which we can do now in part because recent std::array use - should have done so from the start, makes things way simpler!)
Checklist