Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » rant about the state of c++ software

This thread is locked; no one can reply to it. rss feed Print
rant about the state of c++ software
Matthew Leverton
Supreme Loser
January 1999
avatar

Quote:

I have a friend that programs embedded devices and micro-controllers. He uses asm. If he says 'asm is better than C in this domain', should I tell him that he is wrong? he is obviously right.

If he says that ASM allows him to write faster and smaller code, then he is right. If he says that all major micro controllers must be programmed in ASM because of that, then he is wrong.

Quote:

Another take is this: why should you break down the little details when you know the real numbers will not support your arguments?

I don't know how else to say this. This will be my last attempt to get your understanding. Christopher has also summed it up great.

Statement 1: Generally speaking, C++ (and any similar language) will have better performance and less memory requirements than the equivalent code written in Java and C# (and other similar languages).

Statement 2: Most people find that Java and C# are much easier to use and write error free code than with C++.

Statement 3: For most applications, the ease-of-development (Statement 2) trumps the performance loss (Statement 1).

Do we not all agree on those three things? The only reason why I'm still in this discussion is because I find it funny that you are clinging on to your "major application must be written C++" idea.

Your thinking is something like:

  • C++ has better performance than C#

  • Better performance is good

  • Therefore C++ is the only choice for applications that max the CPU.

You should take it a step farther and replace C++ with hand written machine code and C# with C++.

Let's say the C# applications runs 5% slower. You say that is unacceptable performance. Guess what? The C# application running on today's PC is faster than the C++ application running on last year's PC. So I guess all of those people need to upgrade their hardware because the performance is no longer acceptable—because a different environment is faster.

Your fascination with maximum performance must lead you to believe that every "major software" must always be installed only on the very fastest machines available because anything less would be uncivilized—you wouldn't be getting the best performance possible.

But no, what really happens is people run software on hardware that can run the software at speeds that are acceptable to them. It's quite possible (and likely) that C# runs at the same acceptable level as C++ does to the user, even on major applications.

Since Photoshop is a major application to you, I'll use it as my example. The user has non-functional requirements like "a ten megapixal image must be able to be resized into a thumbnail in less than one second." Even if C++ takes 0.01 seconds and C# takes 0.5 seconds, it doesn't matter. Both satisfy the requirement.

Your definition of a "major application" is basically: anything that requires more speed than C# or Java can provide. And in that case, I agree 100%! C# or Java will never be used in that definition of a major application.

BAF
Member #2,981
December 2002
avatar

Quote:

Well, if C# and Java are so fast, it could have been written in those languages. I don't see how extremely experienced programmers that can write C in their sleep have a problem with fancier and easier languages like Java and C#.

The only problem was that C# didn't exist back then and Java didn't either, or was in its infancy.

Quote:

I have a friend that programs embedded devices and micro-controllers. He uses asm. If he says 'asm is better than C in this domain', should I tell him that he is wrong? he is obviously right.

Yes, but in that area it IS better, mainly because you're limited to how much code you can store, very limited with ram and CPU power, etc. There's no shortage of any of that on any of today's computers, so there is no reason to use ASM in most cases.

Quote:

I don't see what the fuss is all about, and I really don't understand the reaction of the Allegro.cc crowd. You all support Matthew, perhaps because he is an American and I am not, or because he is the site owner. But your reaction is not logical. If you check the facts, the numbers, the performance, you will see that I am right.

But you are only supplying heavily biased data that isn't really meaningful at all. I didn't see you present any cold hard benchmarks or anything like that.

Either way, like Christopher and Matthew said, we're not denying that C++ is faster. At least I'm not. I'm just saying that the speed difference doesn't matter much at all.

Thomas Fjellstrom
Member #476
June 2000
avatar

Quote:

Java is also cross platform.

But you can't easily bind EVERY OTHER language to it. ::)

With C, you can bind Java, Python, Perl, Scheme, C#, ObjC and pretty much every other language to it with relative ease.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

axilmar
Member #1,204
April 2001

Quote:

We never denied your numbers. And we never denied the c++ performance is better.
We just denied that not only C++ is able to write major apps.
That was because you definition of major app was/is different from our definition.

Major = performance.

Quote:

When we said you definition of major apps changed over time you said that was not the case.
That means: You meant the same all the time but because you said it differently we understood it differently in every post.
At first you definition of a major app seemed be to be the same as ours.
And with that definition your statement that only c++ can be used was wrong in our opinion.

I never said it differently each time. I explained it differently. It's not my problem if you are stuck to a certain definition.

Quote:

And all we said that c++ will be used less in the future because for most projects this difference in performance will be unimportant.
Then you started to say that c++ will not be used less because it is the only tool to write major apps in.
But apps that are major apps after your definition are needed less then other shabby gui/server apps which c#/java be more then sufficient for.

Yes, C++ is the only tool to write major apps in. And it will continue to be so. And the major apps are not going to go away any time soon, so you are wrong that shabby gui/server apps will dominate.

Quote:

As said above we never wanted to argue about performance because we know this fact.
It isn't arguable.

Ok then.

Quote:

The only thing we argued about was the fact that c++ will be used less and isn't the only language todays apps can be written in.

I don't understand how can you argue on something I never said.

I never said c++ is the only language that apps can be written in. I said c++ is the only language that apps that require performance can be written in. There is a difference.

Quote:

You missed the important part: can be used within other languages

Written in C means it can be used from: C, C++, Java, C#, Ruby... other ones.

So if you want a library that can be used in much languages you choose c.
Which doesn't mean that it is the ONLY language you can write a library in.

Writing it in Java pretty much diminishes the need to use other languages.

Quote:

I don't know where you come from and I don't care. This is the internetz!
Saying something like that is a defamation. I would appreciate if you won't say something like this again.

Ok, I admit that was a little bit over the top.

But at least it got your attention :-).

I would like to note here that it is not an unusual phenomenon for people to support others based on ethnicity or other attributes. For a moment, the collective a.cc reaction seemed like something similar happened.

Quote:

Because Allegro is old. It's origins are what, in 1990 or so? Java and C# didn't exist.

Allegro 5 is not old. It could have been written in other languages.

Quote:

If he says that ASM allows him to write faster and smaller code, then he is right. If he says that all major micro controllers must be programmed in ASM because of that, then he is wrong.

I never said anything else.

Quote:

Statement 1: Generally speaking, C++ (and any similar language) will have better performance and less memory requirements than the equivalent code written in Java and C# (and other similar languages).

Statement 2: Most people find that Java and C# are much easier to use and write error free code than with C++.

Statement 3: For most applications, the ease-of-development (Statement 2) trumps the performance loss (Statement 1).

I agree with this as well. I've already said this.

Quote:

Do we not all agree on those three things? The only reason why I'm still in this discussion is because I find it funny that you are clinging on to your "major application must be written C++" idea.

Your thinking is something like:

* C++ has better performance than C#
* Better performance is good
* Therefore C++ is the only choice for applications that max the CPU.

You should take it a step farther and replace C++ with hand written machine code and C# with C++.

But I never said that!

It's very funny, but everyone understood something else from what I said.

Let me say it again:

Applications that need performance should be written in C++.

Quote:

Let's say the C# applications runs 5% slower. You say that is unacceptable performance. Guess what? The C# application running on today's PC is faster than the C++ application running on last year's PC. So I guess all of those people need to upgrade their hardware because the performance is no longer acceptable—because a different environment is faster.

Again, I agree, with two exceptions:

1) some apps require performance that even tomorrow's PCs can not deliver.
2) PC performance can not grow indefinitely. People are already say that and seeking concurrent solutions.

Quote:

Your fascination with maximum performance must lead you to believe that every "major software" must always be installed only on the very fastest machines available because anything less would be uncivilized—you wouldn't be getting the best performance possible.

I don't have any fascination with anything, including performance. It is people that like to get their job done as fast as possible and then go on and do other things.

Quote:

But no, what really happens is people run software on hardware that can run the software at speeds that are acceptable to them. It's quite possible (and likely) that C# runs at the same acceptable level as C++ does to the user, even on major applications.

Since Photoshop is a major application to you, I'll use it as my example. The user has non-functional requirements like "a ten megapixal image must be able to be resized into a thumbnail in less than one second." Even if C++ takes 0.01 seconds and C# takes 0.5 seconds, it doesn't matter. Both satisfy the requirement.

Your definition of a "major application" is basically: anything that requires more speed than C# or Java can provide. And in that case, I agree 100%! C# or Java will never be used in that definition of a major application.

But the difference is not always that small. Perhaps in the 10 megapixel range, garbage collected languages choke and invoke the collector a lot of times, whereas because C++ has manual memory management, no such thing happens. And then, in your example, resizing a 10 megapixel picture to a thumbnail becomes a 2 second job, and thus it becomes frustrating.

Quote:

Yes, but in that area it IS better, mainly because you're limited to how much code you can store, very limited with ram and CPU power, etc. There's no shortage of any of that on any of today's computers, so there is no reason to use ASM in most cases.

Who said anything about using ASM? I just offered an example of where more performance justifies the use of a more primitive tool.

Quote:

But you are only supplying heavily biased data that isn't really meaningful at all. I didn't see you present any cold hard benchmarks or anything like that.

My data are not biased at all.

Take, for example, databases like DB2, used in enterprises.

If the database was written in Java, for example, wouldn't it have a big performance hit?

In that domain, every bit of performance counts.

I did not present any benchmarks, but I presented code, which makes it obvious why c++ offers better performance.

Quote:

Either way, like Christopher and Matthew said, we're not denying that C++ is faster. At least I'm not. I'm just saying that the speed difference doesn't matter much at all.

It may not matter to you. Or me. But it matters to those that make applications using, for example, the databases mentioned above.

Quote:

But you can't easily bind EVERY OTHER language to it. ::)

With C, you can bind Java, Python, Perl, Scheme, C#, ObjC and pretty much every other language to it with relative ease.

It's not that easy, but the use of Java pretty much diminishes the need to use any other language. The major advantage of these languages, i.e. garbage collection, is also an advantage of Java.

Are there any major games written in anything else than c++? I am asking, I don't know.

count
Member #5,401
January 2005

Quote:

Let me say it again:Applications that need performance should be written in C++.

Agreed. Nothing more to discuss from my side! :)

Quote:

Are there any major games written in anything else than c++? I am asking, I don't know.

Runescape is written in Java. I used to know some more games when I still was interested in Java :P
There are some indie XBox games written in C# and xna. Don't know how much it is used by the "big" developers.

Thomas Fjellstrom
Member #476
June 2000
avatar

Quote:

the use of Java pretty much diminishes the need to use any other language.

You know, except for USER BASE.

Its a bitch to bind to C++, so we choose C. And every other language including C++ bind to C nicely.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

BAF
Member #2,981
December 2002
avatar

Quote:

I said c++ is the only language that apps that require performance can be written in.

Quote:

Applications that need performance should be written in C++.

Your argument is morphing again! You went from must be in C++ to should be in C++ in one post!

Evert
Member #794
November 2000
avatar

Quote:

Your argument is morphing again! You went from must be in C++ to should be in C++ in one post!

Bear in mind that you're speaking to a non-native speaker, for whom nuances of language may not be interpreted in the same way as for you.
I think you're overinterpreting a difference in wording where no difference in meaning was intended.

Thomas Fjellstrom
Member #476
June 2000
avatar

Quote:

I think you're overinterpreting a difference in wording where no difference in meaning was intended.

I'm not so sure. Non native speakers tend to be more anal about the rules than native English speakers. I couldn't care less about them to be honest, but theres several here on the forums for whom its their second or even third language which seem to be highly anal about the rules and various nuances.

The only people I've ever seen that cared so much about it, were all English majors, or professors.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Speedo
Member #9,783
May 2008

Quote:

Allegro 5 is not old. It could have been written in other languages.

A quick scan with a code counter shows Allegro 4.2.2 having some 75,000 lines of code. Are YOU volunteering to rewrite all of them?

kazzmir
Member #1,786
December 2001
avatar

Quote:

But the difference is not always that small. Perhaps in the 10 megapixel range, garbage collected languages choke and invoke the collector a lot of times, whereas because C++ has manual memory management, no such thing happens. And then, in your example, resizing a 10 megapixel picture to a thumbnail becomes a 2 second job, and thus it becomes frustrating.

This seems to be axilmar's main point. Garbage collection (mark and sweep) in every major high level language with an associated vm tends to take up more time than manual memory management. Additional time hogs are error checking and reflection. Without these things any error is likely to completely crash a C/C++ program, but assuming errors don't occur then C/C++ will probably be a winner in terms of performance.

Of course any sufficiently sophisticated program is likely to have a host of errors and it seems more useful to reduce the number of errors by 5% than increase the performance by 5% but it depends on the application domain.

Anyway axilmar, why do you keep claiming that things should be written in C++? C++ is an incredibly thin veil over C and the only other thing going for it (the template system) isn't that impressive compared to other things. Besides the fact that the template system has nothing to do with performance.

If you took out closures I'm sure you could compile Scheme or ML down to C/C++ using explicit memory management. Of course without closures those languages are basically worthless.

Martin Kalbfuß
Member #9,131
October 2007
avatar

Isn't allegro 5 a rewrite?

Kill C++. There are a lot of better languages out there.

I would prefer Pascal. But most people won't. So I vote for C#. With the introduction of Mono, it's multi-platform. And Mono is able to compile C#. So speed shouldn't be a big problem.

http://remote-lisp.spdns.de -- my server side lisp interpreter
http://www.nongnu.org/gm2/ -- Modula-2 alias Pascal++

SiegeLord
Member #7,827
October 2006
avatar

Quote:

Kill C++. There are a lot of better languages out there.

Your metric for 'better' is flawed. There are no better languages out there by my metric.

EDIT: Incidentally, has this been posted yet? I like that metric, faulty as it is, more than the platitudes expressed in this thread.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Matthew Leverton
Supreme Loser
January 1999
avatar

What a shame, it says D is faster than C++. :-/

I guess all performance critical programs must now be written in D.

SiegeLord
Member #7,827
October 2006
avatar

Yay for D. Now if only they could release D 2.0 sometime soon...

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Evert
Member #794
November 2000
avatar

Quote:

There are a lot of better languages out there.

When has that ever been an argument to use one piece of software over another?

Quote:

Incidentally, has this [shootout.alioth.debian.org] been posted yet? I like that metric, faulty as it is, more than the platitudes expressed in this thread.

Interesting how poor FORTRAN is doing in that comparison. One to give to people who keep insisting that FORTRAN code is faster than C/C++ code (and therefore one should not use C/C++). :P
Of course, the (valid) counter argument will be that G95 isn't the best FORTRAN compiler around...

EDIT: yes, people do still make that argument...

Steve++
Member #1,816
January 2002

Quote:

Let me say it again:Applications that need performance should be written in C++.

When you fart in an elevator, it is best to get out at the next floor rather than try to justify it until you (and everyone else) is blue in the face.

Timorg
Member #2,028
March 2002

I agree with Matt and it has absolutely nothing to do with his nationality. In fact its ingrained into Australian society to hate everything and everyone remotely American like, even Canadians. But I am intelligent enough to think beyond that and measure an argument for what it states and what it doesn't.

____________________________________________________________________________________________
"c is much better than c++ if you don't need OOP simply because it's smaller and requires less load time." - alethiophile
OMG my sides are hurting from laughing so hard... :D

Isaac Gouy
Member #10,785
March 2009

SiegeLord wrote 03/15/2009 5:26 PM

> Your metric for 'better' is flawed. There are no better languages out there by my
> metric.

> EDIT: Incidentally, has this [shootout.alioth.debian.org] been posted yet? I like
> that metric, faulty as it is, more than the platitudes expressed in this thread.

The link you provided was to measurements that haven't been updated in at least a year.

Here are up-to-date benchmarks game measurements -

http://shootout.alioth.debian.org/u32q/benchmark.php?test=all&lang=all&box=1

Evert
Member #794
November 2000
avatar

Quote:

Here are up-to-date benchmarks game measurements -

I had a quick look at the C++ and FORTRAN N-body codes they used for comparison, and they're not even doing the exact same thing (in terms of what quantities they calculate) and they don't use the same features (the C++ code doesn't use standard library functions to calculate the square root, for instance).
So take with a bucket of salt.

Martin Kalbfuß
Member #9,131
October 2007
avatar

Maybe throwing in my opinion without any reason wasn't professional and C++ isn't that bad. But "C++ is the holy grail" discussions suck. Many people like C++ because everyone is using it. But that isn't an indicator for its quality. If most people would use fortran they would say exactly the same thing.

http://remote-lisp.spdns.de -- my server side lisp interpreter
http://www.nongnu.org/gm2/ -- Modula-2 alias Pascal++

Kibiz0r
Member #6,203
September 2005
avatar

Quote:

Isn't allegro 5 a rewrite?

Kill C++. There are a lot of better languages out there.

I would prefer Pascal. But most people won't. So I vote for C#. With the introduction of Mono, it's multi-platform. And Mono is able to compile C#. So speed shouldn't be a big problem.

That would be cool, but it would be a separate project from Allegro. Allegro is a C library -- that's just what it is. The only way it could spontaneously blossom into a C# library would be if there was a strong feeling by the community that it was necessary.

But if you're seriously interested in doing that, I'd be on board. (We'd obviously be dispatching into a lot of C DLLs, and I've gotten a lot of experience with that working on Allegro#. ;))

Martin Kalbfuß
Member #9,131
October 2007
avatar

I've tried to do a wrapper for gnu pascal. But gave up, because It was to much work for me at that time. Surely I'm interested. The problem is, that I'm new to C# and mono. So this would take some time.

http://remote-lisp.spdns.de -- my server side lisp interpreter
http://www.nongnu.org/gm2/ -- Modula-2 alias Pascal++

Isaac Gouy
Member #10,785
March 2009

Evert wrote on 03/16/2009 7:43 AM
Quote:
Here are up-to-date benchmarks game measurements -
I had a quick look at the C++ and FORTRAN N-body codes they used for comparison, and they're not even doing the exact same thing (in terms of what quantities they calculate) and they don't use the same features (the C++ code doesn't use standard library functions to calculate the square root, for instance).
So take with a bucket of salt.

double distance = sqrt(dx * dx + dy * dy + dz * dz);

http://shootout.alioth.debian.org/u32q/benchmark.php?test=nbody&lang=gpp&id=1

SiegeLord
Member #7,827
October 2006
avatar

Aww... the newest ones don't have D in them... how sad.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]



Go to: