What's wrong with C++?

A place for Ogre users to discuss non-Ogre subjects with friends from the community.
Post Reply
jjp
Silver Sponsor
Silver Sponsor
Posts: 597
Joined: Sun Jan 07, 2007 11:55 pm
Location: Cologne, Germany
Contact:

Re: What's wrong with C++?

Post by jjp » Tue Feb 09, 2010 5:11 pm

jacmoe wrote:If you're looking for small size source code, why not Lisp ? :D
Or Haskell :P
0 x
Enough is never enough.

User avatar
wacom
Gnome
Posts: 350
Joined: Sun Feb 10, 2008 2:07 pm

Re: What's wrong with C++?

Post by wacom » Tue Feb 09, 2010 5:48 pm

Or HQ9+. For a small "Hello World!" source, that is.
0 x

User avatar
lonewolff
Ogre Magi
Posts: 1199
Joined: Wed Dec 28, 2005 12:58 am
x 2

Re: What's wrong with C++?

Post by lonewolff » Tue Feb 09, 2010 8:49 pm

jjp wrote:You're not answering the question ;) Obviously I mean the size of the source code, not of the compiled code.
That was done in debug.exe. There is no compilation - that is raw assembly. So, source code size is equal to executable size. Right back at ya with the :wink:
0 x

User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7144
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 12

Re: What's wrong with C++?

Post by Kojack » Tue Feb 09, 2010 11:28 pm

Obviously I mean the size of the source code, not of the compiled code.
Hello World in Falcon:

Code: Select all

>"Hello World!"
0 x

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: What's wrong with C++?

Post by jacmoe » Tue Feb 09, 2010 11:49 pm

Lisp:

Code: Select all

(print "Hello World")
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

jjp
Silver Sponsor
Silver Sponsor
Posts: 597
Joined: Sun Jan 07, 2007 11:55 pm
Location: Cologne, Germany
Contact:

Re: What's wrong with C++?

Post by jjp » Tue Feb 09, 2010 11:59 pm

lonewolff wrote:Right back at ya with the :wink:
Does your CPU work on UTF-8-encoded text or what? :P And I was asking for an example where something could be done in C++ with just 10 lines and it would take 300 lines in a higher level language..
0 x
Enough is never enough.

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: What's wrong with C++?

Post by jacmoe » Wed Feb 10, 2010 12:11 am

C++ (with typedef):

Code: Select all

for (HashMap::iterator i = gDict.equal_range(n).begin(); i != gDict.equal_range(n).end(); i++)
Lisp:

Code: Select all

(loop for word in (gethash n *dict*) do
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
Nauk
Gnoll
Posts: 647
Joined: Thu May 11, 2006 9:12 pm
Location: Bavaria
Contact:

Re: What's wrong with C++?

Post by Nauk » Wed Feb 10, 2010 2:06 pm

  • Being really good at C++ is like being really good at using rocks to sharpen sticks. -- Thant Tessman
  • Arguing that Java is better than C++ is like arguing that grasshoppers taste better than tree bark. -- Thant Tessman
  • There are only two things wrong with C++: The initial concept and the implementation. -- Bertrand Meyer
  • C++ has its place in the history of programming languages. Just as Caligula has his place in the history of the Roman Empire. -- Robert Firth
  • C++ is history repeated as tragedy. Java is history repeated as farce. -- Scott McKay
  • C++ is like jamming a helicopter inside a Miata and expecting some sort of improvement. -- Drew Olbrich
  • C++ is the only current language making COBOL look good. -- Bertrand Meyer
  • C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg. -- Bjarne Stroustrup
  • C++: Simula in wolf's clothing. -- Bjarne Stroustrup
  • C++ will do for C what Algol-68 did for Algol. -- David L Jones
  • Historically, languages designed for other people to use have been bad: Cobol, PL/I, Pascal, Ada, C++. The good languages have been those that were designed for their own creators: C, Perl, Smalltalk, Lisp. -- Paul Graham
  • I consider C++ the most significant technical hazard to the survival of your project and do so without apologies. -- Alistair Cockburn
  • If C++ has taught me one thing, it's this: Just because the system is consistent doesn't mean it's not the work of Satan. -- Andrew Plotkin
  • If you think C++ is not overly complicated, just what is a protected abstract virtual base pure virtual private destructor and when was the last time you needed one? -- Tom Cargill
  • I invented the term Object-Oriented, and I can tell you I did not have C++ in mind. -- Alan Kay
  • It has been discovered that C++ provides a remarkable facility for concealing the trival details of a program -- such as where its bugs are. -- David Keppel
  • Java is, in many ways, C++--. -- Michael Feldman
  • Java, the best argument for Smalltalk since C++. -- Frank Winkler
  • PL/I and Ada started out with all the bloat, were very daunting languages, and got bad reputations (deservedly). C++ has shown that if you slowly bloat up a language over a period of years, people don't seem to mind as much.* -- James Hague
  • The last good thing written in C++ was the Pachelbel Canon. -- Jerry Olson
  • To me C++ seems to be a language that has sacrificed orthogonality and elegance for random expediency. -- Meilir Page-Jones
  • Whenever the C++ language designers had two competing ideas as to how they should solve some problem, they said, "OK, we'll do them both". So the language is too baroque for my taste. -- Donald E Knuth
  • *Within C++, there is a much smaller and cleaner language struggling to get out. * -- Bjarne Stroustrup
  • C++ is the best example of second-system effect since OS/360. -- Henry Spencer
  • C++ is an insult to the human brain -- Niklaus Wirth
  • C++: an octopus made by nailing extra legs onto a dog.
found here: http://harmful.cat-v.org/software/c++/ :)
0 x

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: What's wrong with C++?

Post by jacmoe » Wed Feb 10, 2010 2:12 pm

True, except that Java is a clunky, horrible language. :wink:
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2702
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 1

Re: What's wrong with C++?

Post by syedhs » Wed Feb 10, 2010 3:56 pm

# C++: an octopus made by nailing extra legs onto a dog.
That is the definitely the funniest. :) Although I dont know how that conclusion was made hehe.
0 x
A willow deeply scarred, somebody's broken heart
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me

User avatar
MrD
Goblin
Posts: 292
Joined: Wed Oct 21, 2009 3:16 pm
Location: England

Re: What's wrong with C++?

Post by MrD » Wed Feb 10, 2010 4:46 pm

jacmoe wrote:True, except that Java is a clunky, horrible language. :wink:
I used Java once... then I saw the weird "overriding a member function when you create an instance of an object" (of which I don't know the name of) and I got the hell out of there and decided to use C# instead.
Nauk wrote:C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg. -- Bjarne Stroustrup
Here is the Java version:
You locate the Gun class, but discover that the Bullet class is abstract, so you extend it and write the missing part of the implementation. Then you implement the ShootAble interface for your foot, and recompile the Foot class. The interface lets the bullet call the doDamage method on the Foot, so the Foot can damage itself in the most effective way. Now you run the program, and call the doShoot method on the instance of the Gun class. First the Gun creates an instance of Bullet, which calls the doFire method on the Gun. The Gun calls the hit(Bullet) method on the Foot, and the instance of Bullet is passed to the Foot. But this causes an IllegalHitByBullet exception to be thrown, and you die.
0 x
Insimnax Framework - A game framework for OGRE

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: What's wrong with C++?

Post by jacmoe » Wed Feb 10, 2010 5:04 pm

:lol:
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
stealth977
Gnoll
Posts: 638
Joined: Mon Dec 15, 2008 6:14 pm
Location: Istanbul, Turkey

Re: What's wrong with C++?

Post by stealth977 » Wed Feb 10, 2010 8:12 pm

The most effective language: ASM (In terms of executed code size & execution speed + Ultimate Freedom)
Second most effective language : C (You can almost replicate the same executed code size & execution speed + Ultimate Freedom)
Third most effective language : C++ (Again you can replicate the same executed code size & execution speed + Maximum Freedom)

The rest: no chance to replicate executed code size & execution speed & Always Limited in this or that way...

Now, from the production speed perspective, some of 4G languages are 2x+ more productive...

But, productivity depends on what you are working on... Never seen an OS written in C# yet (i know there are OSs which has native C# integration)

Never seen a performance sensitive application written in 4G languages...

The rest, yeah where performance is not the main issue, productivity always decides which tool is going to be used...
0 x
Ismail TARIM
Ogitor - Ogre Scene Editor
WWW:http://www.ogitor.org
Repository: https://bitbucket.org/ogitor

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: What's wrong with C++?

Post by jacmoe » Wed Feb 10, 2010 8:15 pm

C++ is hard, but good libraries makes it easy. :)
Bjarne Stroustrup wrote:"Without a good library, most interesting tasks are hard to do in C++;
but given a good library, almost any task can be made easy."
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
lonewolff
Ogre Magi
Posts: 1199
Joined: Wed Dec 28, 2005 12:58 am
x 2

Re: What's wrong with C++?

Post by lonewolff » Wed Feb 10, 2010 8:46 pm

jacmoe wrote:C++ is hard, but good libraries makes it easy. :)
Bjarne Stroustrup wrote:"Without a good library, most interesting tasks are hard to do in C++;
but given a good library, almost any task can be made easy."
Too true :)
0 x

User avatar
Klaim
Old One
Posts: 2565
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France
Contact:

Re: What's wrong with C++?

Post by Klaim » Thu Feb 11, 2010 1:41 am

It's bad that there is no date to the initial page from the first post. Most of the problems cited -- other than the parsing problem, sure -- were the main concerns for C++0x, making the language syntaxe more unified...

That's the first time I read a rant about C++ that don't talk about managing the memory yourself :lol:

Anyway, I like reading your posts, gentlemen Image
0 x

User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1862
Joined: Sun Mar 08, 2009 5:25 am
x 16

Re: What's wrong with C++?

Post by mkultra333 » Thu Feb 11, 2010 3:56 am

Following the links in this thread I've been reading lots of these "I hate C++" pages. One thing I've noticed is that something I've always thought was a strength of the language is constantly derided as a flaw. That is, the way it doesn't force you into any particular programming paradigm, and the way any problem has a multitude of styles that can be used to solve it. Here I was, naively thinking that was a good thing...

I also see complaints that people end up using subsets of the language, that most people only end up using 10% of it's capabilities. That describes me to a "T" (except maybe 5% would be more accurate) yet I find myself with the freedom to create exactly the apps I want (usually heavy number crunching for graphics or sound.) Again, how is that a bad thing?
0 x
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.

User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2702
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 1

Re: What's wrong with C++?

Post by syedhs » Thu Feb 11, 2010 6:24 am

I think the conclusion (mine btw) can be likened to.. democracy.. someone says that democracy probably has lots of flaws here and there, but it is currently the best governing system we have. And back to the topic, it is probably the same thing with C++ :mrgreen:

C++/CC has survived thru and stay popular many years , and lots and lots of libraries have been developed on it, and there must be concrete reasons why it is so. It is not like we want it (C) to succeed, but because there C itself is good enough for real world usage. But to quote Mr Spiderman's film, with great power come great responsibility - or in this context, with the great power C has, you have to be a better (or great) programmer haha.
0 x
A willow deeply scarred, somebody's broken heart
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me

User avatar
lonewolff
Ogre Magi
Posts: 1199
Joined: Wed Dec 28, 2005 12:58 am
x 2

Re: What's wrong with C++?

Post by lonewolff » Thu Feb 11, 2010 7:46 am

mkultra333 wrote:I also see complaints that people end up using subsets of the language, that most people only end up using 10% of it's capabilities. That describes me to a "T" (except maybe 5% would be more accurate) yet I find myself with the freedom to create exactly the apps I want (usually heavy number crunching for graphics or sound.) Again, how is that a bad thing?
That describes myself as well. I end up writing things in my own way which usually end up being solidly thought out yet simplistic in implentation. I often see code that is derived and subclassed from fifteen different classes and who knows what, wrapped up in twenty seven convienient header and cpp files and I get told that I should program it this way.

Then I think, what is wrong with my stable single fifty line audio wrapper class anyway that would make me want to do all of this when I can go mSound->Play("sound.wav"). Oooh, it sounds identical to the sound that came out the the other guy's ten thousand lines of code in twenty seven convienient header and cpp files. :roll:

This is why I would never work for a commercial company in programming.

End rant :)
0 x

jjp
Silver Sponsor
Silver Sponsor
Posts: 597
Joined: Sun Jan 07, 2007 11:55 pm
Location: Cologne, Germany
Contact:

Re: What's wrong with C++?

Post by jjp » Thu Feb 11, 2010 8:37 am

JustBoo wrote:
jjp wrote:Does your CPU work on UTF-8-encoded text or what? :P And I was asking for an example where something could be done in C++ with just 10 lines and it would take 300 lines in a higher level language..
And you were given an answer.
No I was not. I am still waiting for an example where your source code in C++ is 30 times shorter than it has to be in a higher level language.

I am out of here. Some people here talk about C++ like Jesus Freaks talk about The Holy Book. I prefer a more rational approach when it comes to programming languages.
0 x
Enough is never enough.

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: What's wrong with C++?

Post by jacmoe » Thu Feb 11, 2010 8:58 am

jjp wrote:I am still waiting for an example where your source code in C++ is 30 times shorter than it has to be in a higher level language.
If we consider Pascal higher level than C++, maybe.
That's actually a ridiculous question. :)

Of course you save an awful lot of key strokes when you use a higher level (whatever that means) language.
But if you are referring to C# and VB.NET - it has more to do with the actual framework (.NET) than the language itself.

If you choose a good framework in C++, you can be almost as productive.
But not completely, because C# is better due to it being fully reflective.
I really like C#, being a old-time Delphi enthusiast. :D
Microsoft did the right thing when they hi-jacked the key architect behind Delphi.
jjp wrote:I am out of here. Some people here talk about C++ like Jesus Freaks talk about The Holy Book. I prefer a more rational approach when it comes to programming languages.
It's natural to become emotionally attached to your programming language of choice.
Some would say that it's necessary if you want to keep your sanity. :wink:
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7144
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 12

Re: What's wrong with C++?

Post by Kojack » Thu Feb 11, 2010 9:49 am

I am still waiting for an example where your source code in C++ is 30 times shorter than it has to be in a higher level language.
Ok, here's Hello World in the language Shakespeare (yes, it's a real programming langauge):

Code: Select all

Romeo, a young man with a remarkable patience.
Juliet, a likewise young woman of remarkable grace.
Ophelia, a remarkable woman much in dispute with Hamlet.
Hamlet, the flatterer of Andersen Insulting A/S.

                   Act I: Hamlet's insults and flattery.
                   Scene I: The insulting of Romeo.
[Enter Hamlet and Romeo]
Hamlet:
You lying stupid fatherless big smelly half-witted coward! You are as
stupid as the difference between a handsome rich brave hero and thyself!
Speak your mind!
You are as brave as the sum of your fat little stuffed misused dusty
old rotten codpiece and a beautiful fair warm peaceful sunny summer's
day. You are as healthy as the difference between the sum of the
sweetest reddest rose and my father and yourself! Speak your mind!
You are as cowardly as the sum of yourself and the difference
between a big mighty proud kingdom and a horse. Speak your mind.
Speak your mind!
[Exit Romeo]
                   Scene II: The praising of Juliet.
[Enter Juliet]
Hamlet:
Thou art as sweet as the sum of the sum of Romeo and his horse and his
black cat! Speak thy mind!
[Exit Juliet]
                   Scene III: The praising of Ophelia.
[Enter Ophelia]
Hamlet:
Thou art as lovely as the product of a large rural town and my amazing
bottomless embroidered purse. Speak thy mind!
Thou art as loving as the product of the bluest clearest sweetest sky
and the sum of a squirrel and a white horse. Thou art as beautiful as
the difference between Juliet and thyself. Speak thy mind!
[Exeunt Ophelia and Hamlet]

                   Act II: Behind Hamlet's back.
                   Scene I: Romeo and Juliet's conversation.
[Enter Romeo and Juliet]
Romeo:
Speak your mind. You are as worried as the sum of yourself and the
difference between my small smooth hamster and my nose. Speak your
mind!
Juliet:
Speak YOUR mind! You are as bad as Hamlet! You are as small as the
difference between the square of the difference between my little pony
and your big hairy hound and the cube of your sorry little
codpiece. Speak your mind!
[Exit Romeo]
                   Scene II: Juliet and Ophelia's conversation.
[Enter Ophelia]
Juliet:
Thou art as good as the quotient between Romeo and the sum of a small
furry animal and a leech. Speak your mind!
Ophelia:
Thou art as disgusting as the quotient between Romeo and twice the
difference between a mistletoe and an oozing infected blister! Speak
your mind!
[Exeunt]
I'd guess that's around 30 times larger than the C++ version. :)
0 x

User avatar
lonewolff
Ogre Magi
Posts: 1199
Joined: Wed Dec 28, 2005 12:58 am
x 2

Re: What's wrong with C++?

Post by lonewolff » Thu Feb 11, 2010 11:27 am

jjp wrote:No I was not. I am still waiting for an example where your source code in C++ is 30 times shorter than it has to be in a higher level language.
It is a bit of a strange request. SomeFunction() will always trump any programming language. As, the contents of the function might be a million times larger than any high level request. But, can be neatly wrapped into one statement. :roll:

Look at Ogre for example. Render a whole scene in less than a page of code. But, I guarantee the breakdown of what is going on would almost turn away all but the most dedicated of coders. :wink:

So, back to your first request - it is pretty odd don't you agree?

[edit]
A more valid and exciting request would have been 'What can you do in xx bytes'. (Maybe this can be the next Lounge/Off topic subject - really get the minds thinking :) )
[/edit]

[edit++]
Just my 2 cents worth - no disrespect or hard feelings intended in anyway :D
[/edit++]
0 x

jjp
Silver Sponsor
Silver Sponsor
Posts: 597
Joined: Sun Jan 07, 2007 11:55 pm
Location: Cologne, Germany
Contact:

Re: What's wrong with C++?

Post by jjp » Thu Feb 11, 2010 11:52 am

lonewolff wrote:So, back to your first request - it is pretty odd don't you agree?
If you read the thread you may find that someone made the claim that he could achieve things in 10 lines of C++ which would take 300 lines in a higher level language. And since that is a pretty strong claim I am asking for an example, because I find it hard to believe otherwise. I am asking an odd question because someone made an odd claim ;)

And yes, as has already been said libraries are the main argument for C++.
0 x
Enough is never enough.

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: What's wrong with C++?

Post by jacmoe » Thu Feb 11, 2010 12:21 pm

That claim is plain wrong. :)
C++ is closer to the metal than 4G languages. So even if it's a non-verbose language, you have to write more lines to achieve things which higher-level languages can do in fewer.
Unless, of course, you use a good library.
Even then, you can't compete with a language like C# - especially when doing reflection.
And I can write 5 lines in Lisp, which requires 50 lines in C++.
So, you're right, Jjp.
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

Post Reply