Consortium Related:
In fact, the Union is basically the same as the struct usage, but the union is a common piece of memory here.
In order to properly demonstrate all of its contents, a memory window needs to be called. This was a bit of a time to find out. To share.
Such direct execution simply does not see the specific execution process.
But how do you see them sharing a piece of memory?
from the current window is no way to view the memory, the program must run up ~ to see. But how can I look at it halfway? ~ So in vs2010 and above, calling the memory window is a big premise of setting breakpoints for the program you're working on:
Such as:
Then run the program.
Enter the current interface.
Press F11 to run one step.
And then found that both in the VS compiler environment or in our small window, we saw the next step of the program, and now hit the three address of the consortium. The next step should be to view it in the Memory window.
In run: Click the Debug drop-down menu:
Then click Memory---memory 1(1), window .
And then you can see the bottom left corner. We want the window:
So the memory window appears.
Because our output window is even displayed as:
So we enter this address in memory:
Then tap Enter. You can see the result of our output:
Start execution of Union myunion u;
You get a space, the first address is 0x0034fabc, and the length is 8 bytes.
Then the u.a = 0x1234
The following memory is displayed:
34 12 00 00
Then we execute u.b = 1l
The memory displays are:
01 12 00 00
Then print the amount of memory that the consortium occupies:
4
They then output the addresses of each of their sub-variables, and find that they share a single address in the union, and modify the values in the same place.
Federation and how to bring up memory windows