Explorar el Código

feat: debug模式下关闭IO缓冲

SongZihuan hace 4 años
padre
commit
3b77a301a2
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  1. 6 0
      main.c

+ 6 - 0
main.c

@@ -3,6 +3,12 @@
 int main(int argc, char *argv[]) {
     Inter *inter = NULL;
 
+#ifdef DEBUG
+    setbuf(stdout, NULL);  // debug模式下关闭缓冲区以尽快输出信息便于debug
+    setbuf(stderr, NULL);
+    setbuf(stdin, NULL);
+#endif
+
     atexit(freeArgs);
     signal(SIGINT, SIG_IGN);
     if (setjmp(memVirtualMath_Env) == -1){