[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: c code vs c++ code




Very potentially religious question.

Some ppl think C++ has a huge overhead etcetc, others that C is not 
usable in large scale projects etc.etc.

The thruth is maybe, that in the Unix world things are historically more 
coded in C. So ppl stick to that + their beliefs in the other languages 
shortcommings. Most of these things are hear-say, and are not valid 
(anymore).

Same argument is going on between Java and C++

With the speed of todays processors, and the compiler tech these days I 
would say the differences are minimal between languages for 95% of the code.

When running profiler tools you discover that you propably are spending 
most time in external libs or the kernel. So what does it matter what 
you coded you game in.

/Thomas

Jason Stechschulte wrote:

>The main reason I started trying to write games in Linux was to re-learn
>C++.  I hadn't used it since my University days roughly 5 years ago.
>Now I'm feeling comfortable with it once again, so I started downloading
>other open source games and looking through the source code.
>
>I noticed that most games that are written using C++ code still use C
>code for many things.  Sometimes it is using printf instead of cout and
>other times it is using something like:
>
>FILE *fp = fopen( ... );
>
>instead of 
>
>input.open( ... );
>
>I'm wondering if there is some benefit to using the C code rather than
>the C++ code.  Is it possibly better for porting to other systems?  Or
>is it simply programmer preference?
>
>Since there is a standard for C++, I would think that it is probably
>because the programmer is more familiar with C and is used to using it.
>I know that C code is normally faster than C++ code, but I wouldn't
>think that file handling would be something that needed to be highly
>optimized for speed.
>
>  
>