Still Using C++? |

June 27th, 2008, 05:38 PM
| | | |
Hi,
I am a game developer, sometimes "indy" and sometimes for a small-sized
company. I can't speak for all game developers, but everywhere I've ever
seen people working on games, execution speed has always been the most
important constraint in writing code. Writing readable and maintainable
code is important, but takes a back seat to execution speed.
I work with DirectX and/or OpenGL, always in C++. There are plenty of
things that I'd like to see improved in C++. But as far as I have seen,
C++ continues to be the workhorse of the gaming business. I've noticed, as
I was searching for examples of how to do some particular trick in D3D, a
few samples written in C#.
But what I know about C# is two things: 1) managed code, and 2) garbage
collection. These are both deal breakers for execution speed, in my
opinion. Trying to squeeze the maximum number of triangles and shaders
through the graphics pipe using code running on a virtual machine seems...
well, silly. And as for garbage collection, I've found that any serious 3D
code I've written has needed very explicit control over when things are
allocated and deleted. Rendering 3D invloves lots of very large buffers of
data, many of them changing drastically in size (meaning possible
reallocation) between every frame. Minimizing the expense of
allocation/deletion/reallocation through intelligent code is crucial.
Anyway, it just seems like C++ has been the "big hammer" for game
development for long enough that we've figured out what's good and what's
bad about it. I certainly have my own fairly long list of annoyances, but
I'm not really interested in opening that can of worms here, since it's
already been debated to death.
But I am interested in looking for alternatives. Am I wrong about C# -- is
it a viable alternative for serious programming, or is it a toy? How about
"D? "I've heard good things about it, but I don't know how widely
supported it is. Having well-supported tool chanins, libraries, IDEs,
documentation, and other resources is important.
Just wondering... | 
June 27th, 2008, 05:41 PM
| | | | re: Still Using C++?
On 2008-04-30 08:30, Razii wrote: Quote:
On Wed, 30 Apr 2008 13:39:13 +1200, Ian Collins <ian-news@hotmail.com>
wrote:
> Quote: |
>>Nonsense, how many device drivers or system libraries have you written?
| >
I don't have to write any. I know people who do and they have the same
opinion. A few days ago I saw a video where the guy claimed that C is
far simpler, cleaner and better to write operating system kernels and
device drivers, and C++ brings unnecessary complexity for such
programming tasks.
| Obviously his knowledge of C++ is not as good as it should be. You can
easily write C-style C++ and still benefit from some of the features of
C++, such as the stronger type-checking and function overloading. All
feature in C++ might not be suitable for lowlevel programming, but they
you simply don't use them.
--
Erik Wikström | 
June 27th, 2008, 05:41 PM
| | | | re: Still Using C++?
"Bo Persson" <bop@gmb.dkwrote in message
news:67r918F2ptba7U1@mid.individual.net... Quote:
Razii wrote: Quote:
>On Wed, 30 Apr 2008 13:39:13 +1200, Ian Collins
><ian-news@hotmail.comwrote:
>> Quote:
>>Nonsense, how many device drivers or system libraries have you
>>written?
| >>
>I don't have to write any. I know people who do and they have the
>same opinion. A few days ago I saw a video where the guy claimed
>that C is far simpler, cleaner and better to write operating system
>kernels and device drivers, and C++ brings unnecessary complexity
>for such programming tasks. I have to find the link again. In any
>case, C works best for lower level programming. C++ is not needed
>for such programming tasks. That's not my opinion but opinion of
>many others who do write device drivers and kernels.
| >
Interfacing to the OS might be slightly simpler in C, as the API is often
published as a C style interface.
>
That some guys claim that they don't need C++ features, could also mean
that these hardcode C coders haven't yet realized what they could use it
for. Is that a language problem?
| You can use C++ in the kernel, I would just avoid supporting exceptions and
global constructors/destructors. You could check this out: http://netlab.ru.is/exception/LinuxCXX.shtml
prototype Linux Kernel in C++, humm. | 
June 27th, 2008, 05:41 PM
| | | | re: Still Using C++?
On Wed, 30 Apr 2008 21:54:37 GMT, Erik Wikström
<Erik-wikstrom@telia.comwrote: Quote:
>Obviously his knowledge of C++ is not as good as it should be. You can
>easily write C-style C++ and still benefit from some of the features of
>C++, such as the stronger type-checking and function overloading. All
>feature in C++ might not be suitable for lowlevel programming, but they
>you simply don't use them.
| He was experienced low level programmer and was being interviewed. Let
me see if I can find the video again. | 
June 27th, 2008, 05:42 PM
| | | | re: Still Using C++?
a few samples written in C#.
The main reason, IMO, is, that Microsoft is trying to force programmers to
C# with the XNA kit, which allows you to make games for the X-Box 360.
This is a very kind offer from Microsoft, but it will make you create code
you can hardly port to any other platform then.
So, I'll stick with C++ as there's no real benefit from any other language
for me. |  | | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 225,662 network members.
|