delorie.com/archives/browse.cgi | search |
At 22:17 12/04/2002 +0000, you wrote: >Eli Zaretskii wrote: > > >... snip ... > > > > That's because you forgot a -c in "gcc -o evilalgo.o evilalgo.c", so > > evilalgo.o is actually an executable program, with all the library > > functions already linked in, not just an object file. Tanks a lot for all suggestions. Eli, I change the algorithm, and now I can't detect any difference on performance. ----test.c begins here---------------- #include <stdio.h> #include <stdlib.h> typedef struct { char af[10]; char name[10]; } record; record **dt, *d; int main (void) { int count, c; dt=NULL; for(count=0; count<200000; count++){ if(count%1000==0){ c=count/1000; dt=(record **)realloc(dt, (c+1)*1000*sizeof(record *)); d=dt[count]; d=(record *)calloc(10, sizeof(record)); } return(0); } ----cut here---------------- _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |