Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: command completion taking ages



Sven Wischnowsky wrote:
>+		   (to = (long) i * M_ISIZE * (m_m[i] - m_f[i])), (cu += to));

This is undefined behaviour.  Order of evaluation of function arguments
is unspecified, and there are no intervening sequence points.

-zefram

diff -ru ../z.old/Src/mem.c Src/mem.c
--- ../z.old/Src/mem.c	Wed Mar 15 12:53:07 2000
+++ Src/mem.c	Wed Mar 15 14:26:18 2000
@@ -1247,10 +1247,12 @@
     }
     printf("\nsize\tmalloc\tfree\tdiff\ttotal\tcum\n");
     for (i = 0, cu = 0; i < 1024; i++)
-	if (m_m[i] || m_f[i])
+	if (m_m[i] || m_f[i]) {
+	    to = (long) i * M_ISIZE * (m_m[i] - m_f[i]);
 	    printf("%ld\t%d\t%d\t%d\t%ld\t%ld\n",
 		   (long)i * M_ISIZE, m_m[i], m_f[i], m_m[i] - m_f[i],
-		   (to = (long) i * M_ISIZE * (m_m[i] - m_f[i])), (cu += to));
+		   to, (cu += to));
+	}
 
     if (m_m[i] || m_f[i])
 	printf("big\t%d\t%d\t%d\n", m_m[i], m_f[i], m_m[i] - m_f[i]);
END



Messages sorted by: Reverse Date, Date, Thread, Author