Parcourir la source

feat: debug模式下关闭IO缓冲

SongZihuan il y a 4 ans
Parent
commit
3b77a301a2
1 fichiers modifiés avec 6 ajouts et 0 suppressions
  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){