https://pku-minic.github.io/online-doc/#/misc-app-ref/environment
docker pull maxxing/compiler-dev
docker run -it --rm -v $(pwd):/root/compiler maxxing/compiler-dev bash
在容器内的 Shell 中,键入测试命令。如:
autotest -w wd /root/compiler -riscv
- 函数声明;
- 赋值表达式(返回左值);逗号表达式;
- 指针;取地址;解地址;
- 字符字面量,仅可见字符和
'\n'
。
例:
void swap(int* a, int* b);
int main() {
int a = 42, b = 56;
swap(&a, &b);
putint(a), putch(' ');
putint(b), putch('\n');
return 0;
}
void swap(int* a, int* b) {
int tmp = *a;
*a = *b;
*b = tmp;
}
void change_arr(int (*arr)[3]) {
(*arr)[0] = 1;
(*arr)[1] = 2;
(*arr)[2] = 3;
}
int main() {
int arr[3];
arr[0] = arr[1] = arr[2] = 4;
change_arr(&arr);
putint(arr[0]), putint(arr[1]), putint(arr[2]);
putch('\n');
return 0;
}