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

c code vs c++ code

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.

Jason Stechschulte

Dying is a very dull, dreary affair.  My advice to you is to have
nothing whatever to do with it.
		-- W. Somerset Maughm, his last words