Home > Software engineering >  Is IL instruction "cpobj" applicable for reference types?
Is IL instruction "cpobj" applicable for reference types?

Time:03-02

Microsoft Docs says:

The behavior of cpobj is unspecified if ……, or if classTok does not represent a value type.

But ECMA 335 says:

If typeTok is a reference type, the cpobj instruction has the same effect as ldind.ref followed by stind.ref.

Which is correct?

CodePudding user response:

If we look through the previous editions of ECMA-335, we find that the 3rd edition changed the wording to specify:

If typeTok is a reference type, the cpobj instruction has the same effect as ldind.ref followed by stind.ref.

In editions 1 and 2, the wording matched that on MSDN.

Therefore, I think it's safe to conclude that ECMA-335 6th edition is correct, and MSDN is out of date.

  • Related