Mail Archives: djgpp/1998/03/04/07:00:24
Scott Warner wrote:
> Just out of curiosity, what's the code? Did you compile and link C
code as though it were C++?
>
> There isn't that much difference between the two afaik, but individual
linking libraries could be different.
>
> > So I made a test for comparing computing time.
> > The result is
> > c code : 21 sec
> > c++ code : 57 sec
> > Fortran77 code : 115 sec
> >
> > The test code is quite simple, consisted of 3 nested "for" loops.
>
Let me first thank you for your kind concern.
Main body of my test code is
for(int i=1 ; i<10001 ; i++)
for(int j=1 ; j<10001 ; j++)
for(int k=1 ; k < 11 ; k++) sum += i;
Above code is ,of course , for C++.
In C code, I just moved variable definitions
into the first line of the code.
Like,
int i,j,k;
float sum;
That's all.
I don't think that makes musch difference between C++ and C.
And compile option is ,
C code : gcc -O2 -o testc.exe testc.c
C++ code : gxx -O2 -o testcpp.exe testcpp.cpp
And I'm using DJGPP v.2.10
Did I make some mistakes or misunderstand something important?
Anyway, thank you and wish you goooooooooooooooooooood Luck !!!!
Bum-Seok Hyun
mailto:dominic AT gong DOT snu DOT ac DOT kr
- Raw text -