> Would it also be correct if i hadn't specified LayoutKind::Sequential?
Replying to myself:
Well, since memberA is not guranteed to be the first member in memory, I
suppose it wouldn't be correct to use a pointer to memberA as a pointer
to the struct.
Still, could the GC potentially shift other members around if only one
member is pinned and the LayoutKind is not specified?
I know that when you pin a member of an array, the entire array gets
pinned.
Ronald Laeremans [MSFT] - 06 Jul 2004 16:43 GMT
No, pinning any member will pin the entire object. That is a hard guarantee
that the CLI spec makes.
Practically in the current CLR implementation, different parts do not move
independently or get rearranged at all. Future implementations might in fact
start doing this, so you were correct to think of this possibility.
Ronald Laeremans
Visual C++ team
>> Would it also be correct if i hadn't specified LayoutKind::Sequential?
> Replying to myself:
[quoted text clipped - 6 lines]
> I know that when you pin a member of an array, the entire array gets
> pinned.
Ben Schwehn - 06 Jul 2004 17:46 GMT
> No, pinning any member will pin the entire object. That is a hard guarantee
> that the CLI spec makes.
Thanks!
Ben