[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
c code vs c++ code
- To: linuxgames@sunsite.dk
- Subject: c code vs c++ code
- From: Jason Stechschulte <stech@enormousplow.com>
- Date: Sun, 24 Nov 2002 06:01:21 -0500
- Delivered-To: archiver@seul.org
- Delivered-To: mailing list linuxgames@sunsite.dk
- Delivery-Date: Sun, 24 Nov 2002 06:01:32 -0500
- Mailing-List: contact linuxgames-help@sunsite.dk; run by ezmlm
- Reply-To: linuxgames@sunsite.dk
- Sender: Jason Stechschulte <stech@enormousplow.com>
- User-Agent: Mutt/1.4i
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
stech@enormousplow.com
http://www.enormousplow.com
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