对拍程序
linux:
1 #!/bin/bash 2 while true;do 3 ./data > data.in 4 ./wrong < data.in > wrong.out 5 ./right < data.in > right.out 6 diff wrong.out right.out 7 if [ $? -ne 0 ] ; then break ; fi 8 done
windows:
1 @echo off 2 :loop 3 data>data.in 4 right<data.in> right.out 5 wrong<data.in> wrong.out 6 fc right.out wrong.out 7 if not errorlevel 1 goto loop 8 pause goto loop
还有手动开栈的代码:
int size = 256 << 20; // 256MB char *p = (char*)malloc(size) + size;
__asm__("movl %0, %%esp " :: "r"(p));