[<EntryPoint>] let main argv = let x = 64 if x = 64 then let x = x-16 printfn "%d" x printfn "%d" x System.Threading.Thread.Sleep 2000
The disassembled result shows
let x = 64
00000041 mov dword ptr [rsp+20h],40h
if x = 64 then
00000049 cmp dword ptr [rsp+20h],40h
0000004e jne 0000000000000052
00000050 jmp 0000000000000057
00000052 jmp 00000000000000E0
let x = x-16
00000057 mov eax,dword ptr [rsp+20h]
0000005b add eax,0FFFFFFF0h
0000005e mov dword ptr [rsp+24h],eax
Two x in
let x = x-16
are stored in different memory locations.
That is the reason why printfn produce two different results.
0 件のコメント:
コメントを投稿