説明 †
ローカル変数のアドレスをスタックにpushします。
クラスのメンバ関数を呼ぶときなどに使用されます。
int32クラスのToString()を呼ぶ例 †
1
2
3
4
5
6
7
8
9
10
11
|
-
|
|
|
|
|
|
|
|
!
|
.method static void hoge()
{
.locals( int32 i )
ldloca i call instance string class [mscorlib]System.Int32::ToString() pop
ret
}
|
C#では・・・
1
2
3
4
5
|
-
|
|
!
|
static void hoge()
{
int i;
i.ToString();
}
|
変数のアドレスを標準出力に出力する例 †
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
!
|
.assembly aa{}
.method static void Main()
{
.entrypoint
.locals( int32 i, int32 j )
ldloca i stloc j
ldloca j call instance string class [mscorlib]System.Int32::ToString() call void class [mscorlib]System.Console::WriteLine(string)
ret
}
|
Cでは・・・
1
2
3
4
5
6
7
8
|
-
|
|
|
|
!
|
#include <stdio.h>
void main()
{
int i,j;
j = (int)&i;
printf("%d\n", j );
}
|
書式 †
ldloca <変数名>
参照 †
|
Last-modified: Mon, 27 Jul 2009 03:06:23 JST