By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,269 Members | 1,332 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,269 IT Pros & Developers. It's quick & easy.

Still Using C++?

P: n/a
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...
Jun 27 '08 #1
Share this Question
Share on Google+
53 Replies


P: n/a
None wrote:
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.
An opinion based on prejudices and rumors, I assume. You should base
your opinions on actual experimentation, not on what some C hackers tell
you.

As time has passed, the speed gap between C++ and "higher-level"
languages has diminished. However, there's one thing where C++ still
excels compared to many other languages (although I can't say for sure
if compared to C#): It's possible to make extremely memory-efficient
programs with it (while still preserving a good level of abstraction,
which makes C++ better than C, IMO).
Jun 27 '08 #2

P: n/a
ave
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.
This is very wrong, C# is not as performant as C++ but these two points are
not related to the performance difference.

1) Managed Code
Managed code is compiled at execution time, okay there's some overhead there
as the JIT compiler processes the function. But it only performs the JIT
once. Because of the intermediate code and it's associated information used
to produce the native code, it is highly likely the JIT compiler has better
knowledge of what your code is doing than a C++ compiler. And it's entirely
possible the JIT compiler could produce better native code than a C++
compiler, leading to faster execution times.

2) Garbage Collection
Garbage collection is not a performance hindrance, it's just an environment
change. Typical game development practices attempt to reduce the number of
allocations\frees during gameplay as much as possible. In a garbage
collected language like C# similar practices can mean no garbage is
collected, meaning no loss of performance. Of course, the language is
different and it means different rules need to be practiced during
development, but it's a different language + environment what do you expect?
:)

That being said, C++ is a preferable development language for games because:

1) Cross-platform, PC, PS3, X360, Wii, whatever, all have C++ compilers
maintained by their manufacturers. And whilst the quality of C++ compiler
can vary across platforms, they are (by and large) fairly language
compatible.
2) Inline assembly, when raw speed is necessary. The programmer can simply
drop to the machines level. Until such things as
vectors\matrices\quaternions become intrinsic types of languages it's
unlikely C++ will be left.
3) Familiarity, just about every game developer is familiar with C++, evey
game company expects their engineers to understand C++.
4) It's unlikely every console manufacturer is going to agree on another
language all at once. Leaving C++ the only option currently.

ave
Jun 27 '08 #3

P: n/a
None wrote:
Just wondering...
Well, since you claim to be a game developer, how about trying out other
languages (with small demo programs that test issues you are interested
in, not full-blown games, of course) and report back your findings to
this group?
Jun 27 '08 #4

P: n/a
On Apr 22, 2:09 am, None <n...@none.nonewrote:
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...
I am a hobbiest game developer as well. I do more scientific type apps
on the job. I am frustrated as heck myself. There is a feeling of
limbo right now as far as game development.

Here are my findings:

MS is doing its best to _force_ me to use C# for everything Windows
related
Almost all the new VS enhancements are centered around managed
code.
MSBuild does not work with native C++
Visual designers in VS do not work with native C++
MS's DB integration in VS is limited to managed code
Everytime I look something up in MSDN, I am plagued with
managed code examples instead of native C++
Activity on native C++ forums, for the language, for DirectX,
and otherwise has dropped substantially

I wouldn't mind switching to C# for game development, but fact is, it
is not possible right now.
The problem is that the _only_ library available for C# and DirectX is
XNA
MS admitted themselves XNA is a hobbiest tool in its current state,
has many shortcomings and is not feasable for commercial development.
Worse, MS is going down the path of charging fees for using it!
I started converting my engine to XNA and gave up as the low level
control that is needed for quality game development just isn't there
period.

I am left in Limbo. MS took out hardware excelerated OpenGL. MS's
documentation, IDE, tools, and APIs are all aimed at managed code more
so than native C++. Yet the only graphics API we are available is an
"Indie developer's toy"

So, while I would love to use C#, to make my resume look pretty, and
because development can be much more rapid, not to mention my opinion
that is forces more OO and has some features I like. I simply cannot
development any graphical app and expect any sort of quality.

I really wish MS would make an official statement on their intentions
for the future concerning game development.
I really wish MS would stop forcing things down my throat and give me
options.
I used to be one of those developers that was very pro MS, now they
are really irritating me.

My latest problem is embedding SQL Server Compact for one of my game
apps. Come to find out that if I want to use any of the tutorials or
documentation they have on it, I have to use IDE features in VS 2008,
forcing me to make a $800 upgrade! Could they just patch 2005,
nah....Try to install an old version of SQL Server? error: Your OS is
not supported.

*scream* *end rant*
Jun 27 '08 #5

P: n/a
Christopher wrote:
My latest problem is embedding SQL Server Compact for one of my game
apps. Come to find out that if I want to use any of the tutorials or
documentation they have on it, I have to use IDE features in VS 2008,
forcing me to make a $800 upgrade! Could they just patch 2005,
nah....Try to install an old version of SQL Server? error: Your OS is
not supported.
Have you looked at SQlite3? http://www.sqlite.org/
Jun 27 '08 #6

P: n/a
On Apr 22, 12:46 pm, Matthias Buelow <m...@incubus.dewrote:
Christopher wrote:
My latest problem is embedding SQL Server Compact for one of my game
apps. Come to find out that if I want to use any of the tutorials or
documentation they have on it, I have to use IDE features in VS 2008,
forcing me to make a $800 upgrade! Could they just patch 2005,
nah....Try to install an old version of SQL Server? error: Your OS is
not supported.

Have you looked at SQlite3? http://www.sqlite.org/
Yes, its has limitation that won't work for the particular project.
Jun 27 '08 #7

P: n/a
Matthias Buelow <mk*@incubus.dewrote:
Well, since you claim to be a game developer, how about trying out other
languages (with small demo programs that test issues you are interested
in, not full-blown games, of course) and report back your findings to
this group?
I don't need to "claim to be a game developer" to do that. I don't even
need to write code. Just download the latest DirectX SDK. Most (or all?)
of the samples are offered in both C++ and C#. The samples provide a
decent coverage of the basic aspects of game development.

And there's already plenty of discussion of the perfomance of C++ versus
C#. Just a taste:

http://developers.slashdot.org/artic...3/04/28/163219
&mode=thread&tid=126&tid=127
I think that my original post was worded poorly. Basically, I'm just
wondering what's next, after C++. I use C++, I love C++, I haven't used
anything that suits game development better. But it has its limitations
and its annoyances. Like I said initially, I don't care to enumerate and
debate them. So I just thought some of the comp.lang.c++ gurus might have
some insight on the next workhorse for high performance code... And I was
secertly hoping that the answer isn't C#. :)
Jun 27 '08 #8

P: n/a
Your Name wrote:
Basically, I'm just
wondering what's next, after C++.
I don't believe in a "now this, next that" approach to technology; use
whatever you like and is appropriate. C++ (and C) most likely have a
very long life still before them (hundreds of years?), probably Java
too, not so sure about C#. I would think that dynamic languages (new
dialects of Lisp, etc.) will see a renaissance in the medium-term
future, simply because hardware is now available to accomodate these
systems and languages like Java, Python are all moving in that direction
(especially when mixed with Javascript and XML to provide some poor
man's S-expressions), and more ambitious projects in dynamic modelling
and simulation can be attempted because of more powerful hardware and
better understood problem domains than 20 years ago. This doesn't mean
languages like C++ or C will be left out -- we will likely continue to
see a mix of languages, despite the hype gravel train that needs to move
on from station to station simply because it feeds a number of people. I
think mono-anything is always bad, and a diverse mix of languages and
methodologies is a good thing.
Jun 27 '08 #9

P: n/a
Matthias Buelow <mk*@incubus.dewrote:
I don't believe in a "now this, next that" approach to technology; use
whatever you like and is appropriate.
[...]
I think mono-anything is always bad, and a diverse mix of languages
and methodologies is a good thing.

I know that the "big hammer" approach is not appealing from an idealistic
point of view, but unfortunately, that's just the way it is in game
development. Things just move incredibly fast. There's a new high-end 3D
card every six months. Then there's bound to be a new version of DirectX
to take advantage of the new features of the hardware. Then there are
bound to be middleware companies scrambling to create the first game engine
to take advantage of the new API. There's so much radical overturn in the
industry that SOMETHING simply must become the de facto standard. You
can't just send everyone an e-mail suggesting that we all move to a more
balanced approach. And even if you want to be a lone daredevil and defy
convention by developing your game in some new language or combination of
languages, you run the risk of being a day late with your release, and
having reviewers look at your game and say "Ewwww, those graphics look like
a game from early 2007! What a joke!"

But, progress happens. John Carmack wrote Doom in C, and it was convincing
enough to get the gaming world to part ways with assembly language. If
someone today could offer something that was absolutely 100% backwards
compatible with C++ (meaning that you could just directly plug in existing
DLLs and LIBs), but IN ADDITION provided next-generation features, then we
might get somewhere. It just seems like it's overdue, at this point.
Jun 27 '08 #10

P: n/a
On Apr 22, 12:05 pm, "ave" <a...@nomailplease.comwrote:
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.
This is very wrong, C# is not as performant as C++ but these
two points are not related to the performance difference.
It depends. I know absolutely nothing about managed code,
but...
2) Garbage Collection
Garbage collection is not a performance hindrance,
He wasn't talking in general. He mentionned one very specific
scenario. One in which naïve use of garbage collection will
cause performance problems. In C++, the Boehm collector has
specific additional functions to avoid these problems: you can
allocate large blocks using a special function which tells the
collector that they won't contain any pointers. (You can also
arrange to trigger the collector at a moment when there is very
little actively allocated memory, which should speed things up
considerably too.)

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Jun 27 '08 #11

P: n/a
Your Name wrote:
But, progress happens. John Carmack wrote Doom in C, and it was convincing
enough to get the gaming world to part ways with assembly language. If
someone today could offer something that was absolutely 100% backwards
compatible with C++ (meaning that you could just directly plug in existing
DLLs and LIBs), but IN ADDITION provided next-generation features, then we
might get somewhere. It just seems like it's overdue, at this point.
Well.. I know next to nothing about "state-of-the-art" game development
but I could imagine that one could write the basis and the
performance-critical parts in C++ or C and then write the game logics in
a higher-level or scripting language that interfaces with that. Quake
already did something like that with the QuakeC scripting language.
Jun 27 '08 #12

P: n/a
Jay
On Apr 22, 2:09*am, None <n...@none.nonewrote:
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.
Look and see how many people have D on their resumes. Finding help
is going to be like finding hen's teeth.

Jun 27 '08 #13

P: n/a
Jay wrote:
On Apr 22, 2:09 am, None <n...@none.nonewrote:
>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.

Look and see how many people have D on their resumes. Finding help
is going to be like finding hen's teeth.
Or like looking for sense in a troll post... Come to a rec.guns forum
and ask what organization to join to fight for "gun control". Or ask
in an MacOS forum to which OS to switch, WinNT or WinXP... Come on,
Jay, you know better than to feed the trolls.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 27 '08 #14

P: n/a
On Tue, 22 Apr 2008 07:09:48 GMT, None <no**@none.nonewrote:
>C++ continues to be the workhorse of the gaming business.
This maybe true for computer and console games, but it isn't for PDA
and mobile phone games. In any case, even for computer games, how
about 3D graphics in this demo video

http://tinyurl.com/2g6dhv

and in these games

http://tinyurl.com/4abb48

This is all open source OpenGL and 100% java.
Jun 27 '08 #15

P: n/a
"Victor Bazarov" <v.********@comAcast.netwrote:
Or like looking for sense in a troll post... Come to a rec.guns forum
and ask what organization to join to fight for "gun control". Or ask
in an MacOS forum to which OS to switch, WinNT or WinXP... Come on,
Jay, you know better than to feed the trolls.

Wow... Someone asking about a successor to C++ in a C++ newsgroup is a
troll now. The rules have certainly changed. Apologies to Victor for
wasting his time with a "troll." Odd that he took time out of his busy
Usenet day to post to the thread, himself. Go figure.

The original post was not a troll. C++ has simply been around a long time.
If people in a C++ newsgroup find that offensive in some way, then my
apologies to their delicate sensibilities.
Jun 27 '08 #16

P: n/a
Razii <wh**********@hotmail.comwrote:
On Tue, 22 Apr 2008 07:09:48 GMT, None <no**@none.nonewrote:
>>C++ continues to be the workhorse of the gaming business.

This maybe true for computer and console games, but it isn't for PDA
and mobile phone games. In any case, even for computer games, how
about 3D graphics in this demo video

http://tinyurl.com/2g6dhv

and in these games

http://tinyurl.com/4abb48

This is all open source OpenGL and 100% java.

Well, they look like games from maybe five years ago, or so. Most of them
have no shadows at all (let alone something as modern as soft shadows),
look very low-poly, have no HDR, have no depth-of-field, have flat
water/fluids. It's hard to even spot a single pixel shader, really...
everything appears to be done per-vertex.

I mean, not to bash Java or whatever, but this is what a modern game looks
like (Crysis):

http://z.about.com/d/compactiongames...crysis_010.jpg
Anyway, this thread has died a painful death and I'm a little sorry that I
started it. My question is probably just too vague. Or maybe the simple
answer is just "No, there's nothing on the immediate horizon."
Jun 27 '08 #17

P: n/a
On Apr 24, 5:12 pm, Your Name <n...@none.nonewrote:
I mean, not to bash Java or whatever, but this is what a modern game looks
like (Crysis):

http://z.about.com/d/compactiongames...crysis_010.jpg
So is this:

http://www.mahjong-solitaire.com/mah...ng/mahjong.jpg

Not all games are fast action 3D. There are genres of games that can
be written in Java and even Python.
Jun 27 '08 #18

P: n/a
On Thu, 24 Apr 2008 22:12:26 GMT, Your Name <no**@none.nonewrote:
>I mean, not to bash Java or whatever, but this is what a modern game looks
like (Crysis):

http://z.about.com/d/compactiongames...crysis_010.jpg
There is nothing inherently in this that can't be done in C# or Java
3D. After all, everything runs on top of either OpenGL or Direct3D
anyway. If someone really wanted to, why would this game be
impossible to translate into other languages?

Here is a free version of Quake 2 (yes 10-year old game but translated
to Java). The benchmark shows that it performs pretty close to
original C code.

http://bytonic.de/html/jake2_webstart.html

Jun 27 '08 #19

P: n/a
On Thu, 24 Apr 2008 17:34:42 -0700, "Chris Thomasson"
<cr*****@comcast.netwrote:
>http://bytonic.de/html/jake2_webstart.html

Good luck trying to create a more efficient version of the Crytek engine in
Java.
Haven't we been through this in the other thread? There is nothing
inherently in C++ that you can't do in java RTSJ, including writing
device drivers and using it in Real time systems.

http://www.rtsj.org/

There are a couple of commercial implementation already of RTSJ
and it's been used by Eglin Space Surveillance Radar. If you can use
it in space surveillance radar, why do you think you can't write
Crytek engine with it?

Jun 27 '08 #20

P: n/a
"Razii" <wh**********@hotmail.comwrote in message
news:8u********************************@4ax.com...
On Thu, 24 Apr 2008 17:34:42 -0700, "Chris Thomasson"
<cr*****@comcast.netwrote:
>>http://bytonic.de/html/jake2_webstart.html

Good luck trying to create a more efficient version of the Crytek engine
in
Java.

Haven't we been through this in the other thread? There is nothing
inherently in C++ that you can't do in java RTSJ, including writing
device drivers and using it in Real time systems.

http://www.rtsj.org/

There are a couple of commercial implementation already of RTSJ
and it's been used by Eglin Space Surveillance Radar. If you can use
it in space surveillance radar, why do you think you can't write
Crytek engine with it?
I didn't say you could not do it... Why on earth would you do it? Good luck
trying to convince Ubisoft that Java is more efficient for game engines...

Jun 27 '08 #21

P: n/a
Razii wrote:
There is nothing inherently in this that can't be done in C# or Java
3D. After all, everything runs on top of either OpenGL or Direct3D
anyway. If someone really wanted to, why would this game be
impossible to translate into other languages?
There's more to making such a game than just OpenGL or Direct3D. You
can probably interface with OpenGL using PHP, but that doesn't make PHP
feasible as a language for high-end games.

There's one thing where C++ beats Java, and that's memory usage
optimization. For example, you can't pack objects into arrays in Java
(you can only allocate objects dynamically and put references to them
into arrays, which is often a waste of space).

With such a game memory usage can be a critical thing.
Jun 27 '08 #22

P: n/a
Razii <wh**********@hotmail.comwrote:
Inherently there is no reason why you can't do games in C# and Java.
(if the same quality of libraries/middleware existed as they do in
C++). This can change in future. Mobile games, for example, are not
dominated by C++ (the quality is not the same but it's still a
multi-billion industry).

As for desktop, here is partial list of games in Java 3D (not sure how
recent is the list...).

Of course there's no reason why you "can't do games" in C# and Java. You
can "do games" in Fortran. And you wouldn't even be the first to do it.

But apparently, there IS a reason why you can't do high-end 3D in Java.
Look through that list of games that you yourself posted. That list alone
is evidence enough for me that Java is as much as a decade behind C++ in
this one particular area (game development). I don't know that the reason
is some fundamental failing of the language itself. It may just be that
the support isn't there somehow. But whatever the reason may be, when I
see screenshots like those, it is ABUNDANTLY clear that Java is not a
serious tool for high-end 3D.
Jun 27 '08 #23

P: n/a
On Fri, 25 Apr 2008 09:59:08 GMT, Juha Nieminen
<no****@thanks.invalidwrote:
>There's one thing where C++ beats Java, and that's memory usage
optimization. For example, you can't pack objects into arrays in Java
(you can only allocate objects dynamically and put references to them
into arrays, which is often a waste of space).
The RTSJ implementations allows greater control on memory (including
creating objects on stack).

http://www.rtsj.org/specjavadoc/mem_index.html

Jun 27 '08 #24

P: n/a
On Fri, 25 Apr 2008 17:52:08 GMT, Your Name <no**@none.nonewrote:
I don't know that the reason
is some fundamental failing of the language itself. It may just be that
the support isn't there somehow.
The libraries/middleware weren't there. In any case, we are only
talking games that require very fast action 3D. There is no C++ in
online games that doesn't have these requirements (it's all flash or
java).
Jun 27 '08 #25

P: n/a

"Razii" <wh**********@hotmail.comwrote in message
news:hf********************************@4ax.com...
On Fri, 25 Apr 2008 17:52:08 GMT, Your Name <no**@none.nonewrote:
>I don't know that the reason
is some fundamental failing of the language itself. It may just be that
the support isn't there somehow.

The libraries/middleware weren't there. In any case, we are only
talking games that require very fast action 3D.
Right.

There is no C++ in
online games that doesn't have these requirements (it's all flash or
java).
What type of online games are to talking about? Warcraft?

Jun 27 '08 #26

P: n/a
On Sat, 26 Apr 2008 11:11:26 -0700, "Chris Thomasson"
<cr*****@comcast.netwrote:
>What type of online games are to talking about? Warcraft?

http://games.yahoo.com
http://zone.msn.com
http://www.gamegecko.com/mayaball.php
http://www.pogo.com/home/home.do

Same is true for mobile games too.
Jun 27 '08 #27

P: n/a
On Fri, 25 Apr 2008 17:52:08 GMT, Your Name <no**@none.nonewrote:
>behind C++ in this one particular area (game development
Can you (or anyone else) add the C++ version to the list on the
following page...

http://bubblemark.com/index.htm

(include 512 balls in the option).
Jun 27 '08 #28

P: n/a
Niz
Sounds like you want to use D to me.

On 2008-04-22 22:54:25 +0100, Your Name <no**@none.nonesaid:
If someone today could offer something that was absolutely 100% backwards
compatible with C++ (meaning that you could just directly plug in existing
DLLs and LIBs), but IN ADDITION provided next-generation features, then we
might get somewhere. It just seems like it's overdue, at this point.

Jun 27 '08 #29

P: n/a
On Sat, 26 Apr 2008 21:01:16 -0700, "Chris Thomasson"
<cr*****@comcast.netwrote:
>I am referring to the fact that C/C++ is used in the development of Google's
infrastructure
Either say C or C++. There is no such thing as C/C++. C is #1 language
to do all the lower level stuff. You don't need C++ for that.

Jun 27 '08 #30

P: n/a
"Razii" <wh**********@hotmail.comwrote in message
news:2b********************************@4ax.com...
On Sat, 26 Apr 2008 21:01:16 -0700, "Chris Thomasson"
<cr*****@comcast.netwrote:
>>I am referring to the fact that C/C++ is used in the development of
Google's
infrastructure

Either say C or C++.
I can program C in C++. You need to make some extra casts (e.g., cast
std::malloc), but that's about it. No need to use new/delete in C++. Just
include <cstdliband use std::malloc/free.

You can program C++ in C. Look at Comeau or cfront intermediary output.

Sometimes minimal OO in C can be fairly clean indeed:

http://groups.google.com/group/comp....106926ba5db19f

There is no such thing as C/C++. C is #1 language
to do all the lower level stuff. You don't need C++ for that.
The JSF program uses system software written in C++:

http://www.research.att.com/~bs/JSF-AV-rules.pdf

Fairly stringent coding rules. Templates are encouraged to be engineered as
follows:
__________________________________________________ __________________
namespace Detail {
class Generic_stack_base
{
protected:
Generic_stack();
~Generic_stack();

void push (void *object);
void * pop (void);
bool empty () const;
private:
[...];
};
}
template<class T>
class Stack: private Detail::Generic_stack_base
{
public:
void push (T *object_ptr) {
Detail::GenericStack::push(object_ptr);
}

T * pop (void) {
return static_cast<T*>(Detail::Generic_stack::pop());
}

bool empty () const {
return Detail::Generic_stack::empty();
}
};
__________________________________________________ __________________

Jun 27 '08 #31

P: n/a
On Mon, 28 Apr 2008 21:18:25 -0700, "Chris Thomasson"
<cr*****@comcast.netwrote:
>I can program C in C++.
That would be useless. C++ brings extra complexities that are not
needed to program lower level (templates, inheritance, casting
operators). C is much simpler anyway since the syntax is much easier.
OpenGL is written in C. Java, C# and all higher level languages can
use wrappers to call C functions in OpenGL. There is no reason why you
can't program games in higher languages. The only problem is that
there is not enough game engines yet.

By the way, I did google for "C++ games" (without the quotes)

Results 1 - 100 of about 512,000 for C++ games. (0.35 seconds)

doing the same search for Java games

Results 1 - 100 of about 12,100,000 for java games. (0.22 seconds)

Jun 27 '08 #32

P: n/a
Razii wrote:
On Mon, 28 Apr 2008 21:18:25 -0700, "Chris Thomasson"
<cr*****@comcast.netwrote:
>I can program C in C++.

That would be useless. C++ brings extra complexities that are not
needed to program lower level (templates, inheritance, casting
operators).
Nonsense, how many device drivers or system libraries have you written?

--
Ian Collins.
Jun 27 '08 #33

P: n/a

"Chris Thomasson" <cr*****@comcast.netwrote in message
news:hM******************************@comcast.com. ..
"Razii" <wh**********@hotmail.comwrote in message
news:2b********************************@4ax.com...
>On Sat, 26 Apr 2008 21:01:16 -0700, "Chris Thomasson"
<cr*****@comcast.netwrote:
>>>I am referring to the fact that C/C++ is used in the development of
Google's
infrastructure

Either say C or C++.

I can program C in C++. You need to make some extra casts (e.g., cast
std::malloc), but that's about it. No need to use new/delete in C++. Just
include <cstdliband use std::malloc/free.

You can program C++ in C. Look at Comeau or cfront intermediary output.

Sometimes minimal OO in C can be fairly clean indeed:

http://groups.google.com/group/comp....106926ba5db19f

>There is no such thing as C/C++. C is #1 language
to do all the lower level stuff. You don't need C++ for that.

The JSF program uses system software written in C++:

http://www.research.att.com/~bs/JSF-AV-rules.pdf

Fairly stringent coding rules. Templates are encouraged to be engineered
as follows:
__________________________________________________ __________________
namespace Detail {
class Generic_stack_base
{
protected:
Generic_stack();
~Generic_stack();
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Generic_stack_base();
~Generic_stack_base() throw();

of course!

[...]
};
}

template<class T>
class Stack: private Detail::Generic_stack_base
{
public:
[...]
};
__________________________________________________ __________________
:^(

Jun 27 '08 #34

P: n/a
On Wed, 30 Apr 2008 13:39:13 +1200, Ian Collins <ia******@hotmail.com>
wrote:
>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.
Jun 27 '08 #35

P: n/a
Razii wrote:
On Wed, 30 Apr 2008 13:39:13 +1200, Ian Collins <ia******@hotmail.com>
wrote:
>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.
Well let them post those opinions, mine are based on my day job and I
can tell you device drivers and other "low level" code can exploit the
same benefits C++ brings as any other.

Please stick to posting within your own knowledge and stop regurgitating
second hand opinions you can't back up.

--
Ian Collins.
Jun 27 '08 #36

P: n/a
On Wed, 30 Apr 2008 19:00:21 +1200, Ian Collins <ia******@hotmail.com>
wrote:
>Well let them post those opinions, mine are based on my day job and I
can tell you device drivers and other "low level" code can exploit the
same benefits C++ brings as any other.
Experts don't agree. C++ brings complexity that is not needed. Low
level programming can be done fine and cleanly with C, which is more
popular than C++ anyway.

Jun 27 '08 #37

P: n/a
Razii wrote:
On Wed, 30 Apr 2008 19:00:21 +1200, Ian Collins <ia******@hotmail.com>
wrote:
>Well let them post those opinions, mine are based on my day job and I
can tell you device drivers and other "low level" code can exploit the
same benefits C++ brings as any other.

Experts don't agree. C++ brings complexity that is not needed. Low
level programming can be done fine and cleanly with C, which is more
popular than C++ anyway.
Speaking from personal experience again?

--
Ian Collins.
Jun 27 '08 #38

P: n/a
Ian Collins wrote:
Razii wrote:
>On Wed, 30 Apr 2008 19:00:21 +1200, Ian Collins <ia******@hotmail.com>
wrote:
>>Well let them post those opinions, mine are based on my day job and I
can tell you device drivers and other "low level" code can exploit the
same benefits C++ brings as any other.

Experts don't agree. C++ brings complexity that is not needed. Low
level programming can be done fine and cleanly with C, which is more
popular than C++ anyway.
Speaking from personal experience again?
What is it that you object to:

(a) not speaking from personal experience, or
(b) not naming the sources you rely on but refering to some
unnamed "experts"?

Objecting to (a) is just silly. It throws out citing references,
encyclopedias, knowledge learned through education, and much more of what
is necessary to have a cultural heritage. Mankind would still be on trees
if all that counts was personal experience.

On the other hand, (b) is a valid objection.
Best

Kai-Uwe Bux
Jun 27 '08 #39

P: n/a
Kai-Uwe Bux wrote:
Ian Collins wrote:
>Razii wrote:
>>On Wed, 30 Apr 2008 19:00:21 +1200, Ian Collins <ia******@hotmail.com>
wrote:

Well let them post those opinions, mine are based on my day job and I
can tell you device drivers and other "low level" code can exploit the
same benefits C++ brings as any other.
Experts don't agree. C++ brings complexity that is not needed. Low
level programming can be done fine and cleanly with C, which is more
popular than C++ anyway.
Speaking from personal experience again?

What is it that you object to:

(a) not speaking from personal experience, or
(b) not naming the sources you rely on but refering to some
unnamed "experts"?

On the other hand, (b) is a valid objection.
b) This fool continues to spout unsubstantiated nonsense.

--
Ian Collins.
Jun 27 '08 #40

P: n/a
On Apr 25, 6:19 pm, Razii <whatever1...@hotmail.comwrote:
The RTSJ implementations allows greater control on memory (including
creating objects on stack).

http://www.rtsj.org/specjavadoc/mem_index.html
How many different Javas are there? J2ME, J2SE, J2EE, now RTSJ.
Jun 27 '08 #41

P: n/a
Razii wrote:
On Wed, 30 Apr 2008 13:39:13 +1200, Ian Collins
<ia******@hotmail.comwrote:
>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?

Bo Persson
Jun 27 '08 #42

P: n/a
LR
Ian Collins wrote:
Kai-Uwe Bux wrote:
>Ian Collins wrote:
>>Razii wrote:
On Wed, 30 Apr 2008 19:00:21 +1200, Ian Collins <ia******@hotmail.com>
wrote:

Well let them post those opinions, mine are based on my day job and I
can tell you device drivers and other "low level" code can exploit the
same benefits C++ brings as any other.
Experts don't agree. C++ brings complexity that is not needed. Low
level programming can be done fine and cleanly with C, which is more
popular than C++ anyway.

Speaking from personal experience again?
What is it that you object to:

(a) not speaking from personal experience, or
(b) not naming the sources you rely on but refering to some
unnamed "experts"?

On the other hand, (b) is a valid objection.
b) This fool continues to spout unsubstantiated nonsense.
Sorry, but I don't understand your post.

Are you implying that his claims can be substantiated? If so, which ones?

I think these are the claims.

1) Experts don't agree.
2) C++ brings complexity that is not needed.
3) Low level programming can be done fine and cleanly with C.
4) [C] (which) is more popular than C++ anyway.

I think 1) is clearly true, perhaps almost self-evident, although, the
word "expert" has not been clearly defined.

I suspect that 2) is not testable, although, I think that C++ has some
features that are useful in attacking complexity. I think this is
important because I believe the relevant issue is not usually the
complexity of our tools, but the complexity of the problems we use our
tools to solve and even simple problems can become more tractable with
the application of these features.

I believe Items 3) and 4) are dependent on the definitions of "fine",
"cleanly" and "popular".

Perhaps http://www.parashift.com/c++-faq-lite/big-picture.html might
help in dealing with some of these questions. Particularly
http://www.parashift.com/c++-faq-lit...e.html#faq-6.5.

LR

Jun 27 '08 #43

P: n/a
LR wrote:
I suspect that 2) is not testable, although, I think that C++ has some
features that are useful in attacking complexity. I think this is
important because I believe the relevant issue is not usually the
complexity of our tools, but the complexity of the problems we use our
tools to solve and even simple problems can become more tractable with
the application of these features.
This is the most important point: Writing nontrivial programs is hard
enough and one needs all the expressiveness a programming language can
offer. C++ is more expressive than C; that doesn't mean that C isn't a
useful language but it's certainly better for smaller programs than for
large ones; perhaps ideal for the kind of micro-benchmarks that "Razii"
seems to be so fond of.
Jun 27 '08 #44

P: n/a
LR <lr***@superlink.netwrites:
Are you implying that his claims can be substantiated? If so, which ones?

I think these are the claims.

1) Experts don't agree.
2) C++ brings complexity that is not needed.
3) Low level programming can be done fine and cleanly with C.
4) [C] (which) is more popular than C++ anyway.

I think 1) is clearly true, perhaps almost self-evident, although, the
word "expert" has not been clearly defined.

I suspect that 2) is not testable, although, I think that C++ has some
features that are useful in attacking complexity.
It's perfectly testable. Just write the same program in C++ and in
another programming language. All I can say here, is that when I
switched to Common Lisp, I got the idea to convert my libraries (not
only C++, but including C++) into lisp, and:

1- only one tenth of the libraries were useful in Lisp,

2- of the tenth I eventually translated in Lisp, then ended having
only one tenth of the size.

Ok, the comparison with Lisp is unfair; you can just test it writting
the same programm in C++ and Eiffel, or even in C++ and Objective-C.

I think this is
important because I believe the relevant issue is not usually the
complexity of our tools, but the complexity of the problems we use our
tools to solve and even simple problems can become more tractable with
the application of these features.

I believe Items 3) and 4) are dependent on the definitions of "fine",
"cleanly" and "popular".
In anycase, popularity can be measured easily enough, and you can come
with reasonable and measurable definitions for "fine" an "cleanly".

--
__Pascal Bourguignon__
Jun 27 '08 #45

P: n/a
LR
Pascal J. Bourguignon wrote:
LR <lr***@superlink.netwrites:
>Are you implying that his claims can be substantiated? If so, which ones?

I think these are the claims.

1) Experts don't agree.
2) C++ brings complexity that is not needed.
3) Low level programming can be done fine and cleanly with C.
4) [C] (which) is more popular than C++ anyway.

I think 1) is clearly true, perhaps almost self-evident, although, the
word "expert" has not been clearly defined.

I suspect that 2) is not testable, although, I think that C++ has some
features that are useful in attacking complexity.

It's perfectly testable. Just write the same program in C++ and in
another programming language. All I can say here, is that when I
switched to Common Lisp, I got the idea to convert my libraries (not
only C++, but including C++) into lisp, and:

1- only one tenth of the libraries were useful in Lisp,
Only one tenth? Each language has some idiomatic features. I wonder if
you were maintaining C++'s idiom in your translation? Or maybe you
wouldn't want to?
>
2- of the tenth I eventually translated in Lisp, then ended having
only one tenth of the size.
I'm not that familiar with Lisp, but I'd be curious to know if you
maintained things like being able to provide a type for an array or
vector<>. C++ and Lisp are so different that you may be right when you say:

Ok, the comparison with Lisp is unfair;
Perhaps. Perhaps not. Depending on what your criteria for unfair
comparisons is.

you can just test it writting
the same programm in C++ and Eiffel, or even in C++ and Objective-C.

What program would you suggest writing? Hello World? A payroll
application? Ecological or economic system modeling?
How would you, in context, define, "complexity", how to "bring
complexity" and decide if it was not needed?

I suggest that none of that is simple. Perhaps it's not doable. Please
see claim 1).

A quick example. Suppose there is an OO language that doesn't support
the concept of dtors. I want to implement a class similar to
std::ifstream in this language. Does the fact that I have to 'manually'
close the file mean that C++ brings complexity that is not needed? Or
does the absence of dtors actually make the code I, as a user of the
language, have to write more complex?
>I think this is
important because I believe the relevant issue is not usually the
complexity of our tools, but the complexity of the problems we use our
tools to solve and even simple problems can become more tractable with
the application of these features.

I believe Items 3) and 4) are dependent on the definitions of "fine",
"cleanly" and "popular".

In anycase, popularity can be measured easily enough,
Provided "popularity" is defined first.
and you can come
with reasonable and measurable definitions for "fine" an "cleanly".
Yes, of course you can. But those definitions would have to be provided
by the person making the claim. And of course, once the terms are
defined, the claims can be challenged. Even the validity and usefulness
of the definition in the context of the claims can be challenged.

In the end, I think the claims made do not serve a particularly useful
purpose. Just my opinion. YMMV.
LR
Jun 27 '08 #46

P: n/a
Ian Collins wrote:
Razii wrote:
[blither blather]
Nonsense, how many device drivers or system libraries have you
written?

Who cares? He's a troll.


Brian
Jun 27 '08 #47

P: n/a
On Wed, 30 Apr 2008 05:39:55 -0700 (PDT), lb*******@yahoo.com wrote:
>How many different Javas are there? J2ME, J2SE, J2EE, now RTSJ.
The syntax and language is same. Some part of libraries and, in some
cases like RTSJ and ME, the VM is targeted for specific task.

Jun 27 '08 #48

P: n/a
On Wed, 30 Apr 2008 20:49:46 +1200, Ian Collins <ia******@hotmail.com>
wrote:
>Speaking from personal experience again?
Yes, the experts who claim that C is simpler and easier to use for
lower level programming are speaking from personal experience.

Jun 27 '08 #49

P: n/a
Razii wrote:
Yes, the experts who claim that C is simpler and easier to use for
lower level programming are speaking from personal experience.
You, however, admit to not being an "expert" yourself, and therefore you
are not able to tell real "experts" from fake ones. Therefore, your
assertion that "experts claim ..." has no more substance than random
hearsay.
Jun 27 '08 #50

53 Replies

This discussion thread is closed

Replies have been disabled for this discussion.