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

UiaElement copy ctor and assignment operator do subtly different things #23

Open
mlalic opened this issue Oct 7, 2020 · 1 comment
Open
Labels
UiaOperationAbstraction Issues that are related to the UiaOperationAbstraction C++ static library

Comments

@mlalic
Copy link
Contributor

mlalic commented Oct 7, 2020

In the following snippet...

void Fn(UiaElement original)
{
  UiaElement newElement = original;
}

The newElement will end up aliasing the same remote object. More precisely, it'll refer to the same operand register as original (on the lowest-level of Remote Ops bytecode).

Meanwhile, in the following...

void Fn(UiaElement original)
{
  UiaElement newElement{ nullptr };
  newElement = original;
}

A Set instruction is emitted in the bytecode that assigns the original element to a new operand register in the bytecode.


This means that two things that typically should work the same (the copy ctor and assignment operator) end up with subtly different behavior.

This issue tracks making a decision about this -- whether to try to make any changes to make these two operations work the same way or whether to document this rough edge as expected/by design.

@mlalic
Copy link
Contributor Author

mlalic commented Oct 7, 2020

In a way this is related to #6 -- except for ints the current behavior seems obviously broken. Perhaps that should be an indication that we should make a fix across the board where copy ctors just do the same thing as assignment operators.

@mlalic mlalic changed the title UiaElement ctor and assignment operator do subtly different things UiaElement copy ctor and assignment operator do subtly different things Oct 7, 2020
@mlalic mlalic added the UiaOperationAbstraction Issues that are related to the UiaOperationAbstraction C++ static library label Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
UiaOperationAbstraction Issues that are related to the UiaOperationAbstraction C++ static library
Projects
None yet
Development

No branches or pull requests

1 participant