[Freeciv-Dev] Re: #define $#@$%! template
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Wed, Apr 26, 2000 at 09:05:10PM -0500, Michael H. Price II wrote:
> On Thu, Apr 27, 2000 at 01:00:29AM +0200, Tomasz Wegrzanowski wrote:
> > > I'm open to discussion.
> >
> > And cons are :
> > - less people know c++ that c
>
> If you continue that argument to its logical conclusion then no new
> language would ever be developed. There is a learning curve associated
> with any new product. Using it as an excuse not to learn is just silly.
It's not that core developers won't learn, we will simply have less
supporters that do more than new nations. Switching to perl will
probably end with more supporters, but I won't try any money against
this claim.
> > - c++ compiles much slower
>
> If you limit yourself to one object (or group of very closely related
> objects) per source file then you will be hard pressed to notice any
> decrease in speed versus a C compiler.
read further
> > - c++ compiler makes worse code
>
> People write worse code because they don't know the language as well
> as they think they do. Write proper C++ code and you will get very
> good code from any modern compiler. I challenge you to provide an
> example supporting your claim.
I accept your challenge
testing script `ctest' :
--- start ---
#!/bin/sh
time for n in 1 2 3 4 5 6 7 8 9 10 ; do gcc hello.c -o c ; done
time for n in 1 2 3 4 5 6 7 8 9 10 ; do g++ hello.C -o cplus ; done
ls -l c cplus
time for n in 1 2 3 4 5 6 7 8 9 10 ; do ./c ; done
time for n in 1 2 3 4 5 6 7 8 9 10 ; do ./cplus ; done
--- end ---
(hello.c and hello.C are both links to hello, this is the most fair way I found)
hello file :
--- start ---
int main () {
return 0;
}
--- end ---
(there is NO easier file)
$ ./ctest >log 2>&1
$ cat log
--- start ---
real 0m3.514s
user 0m2.280s
sys 0m0.830s
real 0m5.900s
user 0m3.130s
sys 0m0.990s
-rwxrwxr-x 1 bashiz bashiz 4583 Apr 27 17:25 c
-rwxrwxr-x 1 bashiz bashiz 4977 Apr 27 17:25 cplus
real 0m0.079s
user 0m0.020s
sys 0m0.060s
real 0m0.275s
user 0m0.150s
sys 0m0.030s
--- end ---
As you see, c++ compiler runs slower, makes bigger code, makes slower code
for simplest hello code. I have also tried more complex code :
--- start ---
#include "stdio.h"
int main () {
printf ("Hello, world\n");
return 0;
}
--- end ---
$ ./ctest >log 2>&1
$ cat log
--- start ---
real 0m7.110s
user 0m3.160s
sys 0m1.070s
real 0m9.636s
user 0m4.470s
sys 0m1.190s
-rwxrwxr-x 1 bashiz bashiz 4717 Apr 27 17:35 c
-rwxrwxr-x 1 bashiz bashiz 5115 Apr 27 17:35 cplus
Hello, world
Hello, world
Hello, world
Hello, world
Hello, world
Hello, world
Hello, world
Hello, world
Hello, world
Hello, world
real 0m0.089s
user 0m0.030s
sys 0m0.050s
Hello, world
Hello, world
Hello, world
Hello, world
Hello, world
Hello, world
Hello, world
Hello, world
Hello, world
Hello, world
real 0m0.953s
user 0m0.150s
sys 0m0.080s
--- end ---
Again, slower compiler, bigger code, slower code.
I have tried to check assembler output,
c and objc make the same code
c++ adds twice much labels and some strange db's list on the end
What do you think ???
- [Freeciv-Dev] what the $#@$%!, Jeff Mallatt, 2000/04/26
- [Freeciv-Dev] #define $#@$%! template, Nicolas BRUNEL, 2000/04/26
- [Freeciv-Dev] Re: #define $#@$%! template, Dan Gohman, 2000/04/26
- [Freeciv-Dev] Re: #define $#@$%! template, Tomasz Wegrzanowski, 2000/04/26
- [Freeciv-Dev] Re: #define $#@$%! template, Thue Janus Kristensen, 2000/04/26
- [Freeciv-Dev] Re: #define $#@$%! template, Michael H. Price II, 2000/04/26
- [Freeciv-Dev] Re: #define $#@$%! template, paulz, 2000/04/26
- [Freeciv-Dev] Re: #define $#@$%! template, Dan Gohman, 2000/04/26
- [Freeciv-Dev] OO model for Freeciv? (was: #define $#@$%! template), Reinier Post, 2000/04/27
- [Freeciv-Dev] Re: #define $#@$%! template, Tomasz Wegrzanowski, 2000/04/27
- [Freeciv-Dev] Re: #define $#@$%! template,
Tomasz Wegrzanowski <=
- [Freeciv-Dev] Re: #define $#@$%! template, Vasco Alexandre Da Silva Costa, 2000/04/27
- [Freeciv-Dev] Re: #define $#@$%! template, Tomasz Wegrzanowski, 2000/04/27
[Freeciv-Dev] Re: what the $#@$%!, Thue Janus Kristensen, 2000/04/26
|
|