Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is IL instruction "cpobj" applicable for reference types?

Tags:

c#

clr

cil

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?

like image 698
SE12938683 Avatar asked Jun 03 '26 19:06

SE12938683


1 Answers

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.

like image 90
canton7 Avatar answered Jun 05 '26 07:06

canton7



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!