Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>FWIW, on mono 2.8+ both return values are False, outputting</p> <pre><code>False False </code></pre> <p>Amazingly, csc.exe from VS2010 produces different results, indeed, outputting:</p> <pre><code>False True </code></pre> <p>Even more interestingly, the problem <strong>appears <em>not</em> with the generated IL code</strong>, but with the Framework implementation/JIT engine; </p> <ul> <li>executing the MS-compiled image with the Mono VM results in <code>False/False</code>, like the mono compiled version</li> <li>executing the Mono-compiled image with the MS VM results in <code>False/True</code>, like the MS compiled version</li> </ul> <hr> <p>For your interest, here are the disassemblies of Microsoft's CSC.exe compiler (<code>csc.exe /optimize+ test.cs</code>):</p> <pre><code>.method private static hidebysig default bool Compare&lt;T&gt; (!!T x, !!T y) cil managed { // Method begins at RVA 0x2087 // Code size 30 (0x1e) .maxstack 8 IL_0000: ldarg.0 IL_0001: box !!0 IL_0006: brfalse.s IL_001c IL_0008: ldarga.s 0 IL_000a: ldarg.1 IL_000b: box !!0 IL_0010: constrained. !!0 IL_0016: callvirt instance bool object::Equals(object) IL_001b: ret IL_001c: ldc.i4.0 IL_001d: ret } // end of method Program::Compare </code></pre> <p>and Mono's gmcs.exe compiler (<code>dmcs -optimize+ test.cs</code>):</p> <pre><code>.method private static hidebysig default bool Compare&lt;T&gt; (!!T x, !!T y) cil managed { // Method begins at RVA 0x212c // Code size 33 (0x21) .maxstack 4 IL_0000: ldarg.0 IL_0001: box !!0 IL_0006: brfalse IL_001f IL_000b: ldarga.s 0 IL_000d: ldarg.1 IL_000e: box !!0 IL_0013: constrained. !!0 IL_0019: callvirt instance bool object::Equals(object) IL_001e: ret IL_001f: ldc.i4.0 IL_0020: ret } // end of method Program::Compare </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload