legal-9

来自「用Java实现的编译器。把源代码编译成SPARC汇编程序」· 代码 · 共 60 行

TXT
60
字号
class Program{    int array_cst_in_class[4];    void test(int i, int j)    {        callout("printf","test received %d, should be %d\n",i,j);    }    int test2()    {        return array_cst_in_class[0];    }    int test3()    {        array_cst_in_class[1] = array_cst_in_class[2];	return 1;    }    void main()    {	int i1, i2, i3;        // first test all the local/stack array stuff	i1 = 0;	i2 = 0;	i3 = 0;	while(i1 < 4) {	  array_cst_in_class[i1] = i1;	  i1 = i1+1;	}        i1 = 0;	while(i1 < 4) {          callout("printf","%d:%d ",i1,array_cst_in_class[i1]);          i1 = i1+1;	}        callout("printf","\n");	test(array_cst_in_class[2],2);	test(array_cst_in_class[i1*4-14],2);        callout("printf","should be 2: %d\n",	        array_cst_in_class[array_cst_in_class[2]]);	array_cst_in_class[0] = array_cst_in_class[1];        callout("printf","should be 2: %d\n",	        1+array_cst_in_class[array_cst_in_class[test2()]]);        callout("printf","should be 2: %d\n",	        array_cst_in_class[array_cst_in_class[test3()]]);    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?