Code: Select all
using System;
namespace MyTestApp
{
internal class Program
{
static void Main(string[] args)
{
int? v = null;
if (v > 0)
{
Console.WriteLine("Somehow compiled?");
}
}
}
}
< /code>
Chatgpt stimmt sehr kategorisch zu, dass die Kompilierung mit CS0266 fehlschlägt: Typ 'Bool?' kann nicht implizit konvertiert werden. zu 'bool'.
Ich kann in der Demontage sehen >
Ich bin verwirrt ... ist das neue Compiler-Verhalten?
Code: Select all
int? v = null;
0178087F lea edi,[ebp-44h]
01780882 xorps xmm0,xmm0
01780885 movq mmword ptr [edi],xmm0
if (v > 0)
01780889 lea edi,[ebp-50h]
0178088C lea esi,[ebp-44h]
0178088F movq xmm0,mmword ptr [esi]
01780893 movq mmword ptr [edi],xmm0
01780897 xor edx,edx
01780899 mov dword ptr [ebp-54h],edx
0178089C lea ecx,[ebp-50h]
0178089F call System.Nullable`1[[System.Int32, mscorlib]].GetValueOrDefault() (70081820h)
017808A4 mov dword ptr [ebp-58h],eax
017808A7 mov eax,dword ptr [ebp-58h]
017808AA cmp eax,dword ptr [ebp-54h]
017808AD setg al
017808B0 movzx eax,al
017808B3 mov dword ptr [ebp-5Ch],eax
017808B6 lea ecx,[ebp-50h]
017808B9 call System.Nullable`1[[System.Int32, mscorlib]].get_HasValue() (700817F0h)
017808BE mov dword ptr [ebp-60h],eax
017808C1 mov eax,dword ptr [ebp-5Ch]
017808C4 and eax,dword ptr [ebp-60h]
017808C7 and eax,0FFh
017808CC mov dword ptr [ebp-48h],eax
017808CF cmp dword ptr [ebp-48h],0
017808D3 je MyTestApp.Program.Main(System.String[])+09Bh (017808E3h)
{
017808D5 nop
Console.WriteLine("Somehow compiled?");