"Does C++ Have a Future?"

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

C++? At least it's not duck-typing :clown:

Post

I've been told that Java 'hotspot' is as fast as native code, but I've yet to be shown something that actually is.
A common property of languages that are marketed to management instead programmers.
~stratum~

Post

See https://benchmarksgame-team.pages.debia ... marksgame/ for a lot of comparisons.
C++ vs C# is only magnitudes faster for the regex-redux algorithm, probably due to a lousy implementation.
We are the KVR collective. Resistance is futile. You will be assimilated. Image
My MusicCalc is served over https!!

Post

The beauty of C (and possibly it's most scary side ;) ) is that it can be seen as a high-level access to low-level programming. It's as if you're writing in assembler, but need to type much less and in a much more readable form. Sorta high-level assembler.

C++ inherited most of it and, despite trying really hard (I'm halfway kidding here, but I hope you get what I'm hinting at ;) ), fortunately didn't get rid of this legacy yet. So, while having even more high-level programming features, one is still capable of controlling what's going on on the low level.

So, one has the whole spectrum from almost machine-code level to high-level language features. One can think in any of these terms and be able express the ideas in C++. Thus one is simultaneously capable of constructing very complex architectures and/or write very efficient and predictable implementations, staying in control (still) of what's going on. And it saves you lots of typing :D

With other languages you are much more at the mercy of the compiler, language runtime and other things. Sure, with time they do their job better and better. But... the so-called nonfunctional aspects (memory usage, performance, esp. in edge cases which pop up every now and then). So, on the average they might even compare to C++, but are we caring only about the average or the worst case performance? Also, how often do you get to the edge cases? The more you want to push the limits, the more you're likely to. So C++ gives you more options in pushing the limits.

One way around it is, if almost nobody would use C++ anymore, people will get used to accepting the mentioned issues (read: software getting bigger and slower ;) ). So it's like a self-sustaining system. As long as people use C++ (and do it in an efficient way), chances are C++ will still shine for quite a while. If nobody uses it anymore, people get to accept what there is.

Of course I'm not saying that there are no other languages which are capable of properly competing with C++. Maybe there are. But I personally still have to see a successful competition in terms of described above.

Post

Z1202 wrote: But I personally still have to see a successful competition in terms of described above.
There used to be Object Pascal by Borland, and I don't recall anything else. I'm sure people will mention that D also works if you disable half of it.
~stratum~

Post

The speed test I've seen bigging-up C# call a lot of native library code, which of course is fine of you're doing render heavy game code, or any mundane system stuff like hard-drive searching etc. It's when you start doing proper algorithms, that shows C++ as king.
Also if you're not an arse about obfuscating (ie loving the language too much, rather than what you're actually making), C++ can make life a whole lot easier - take Juce as a fine example of c++ being readable and friendly(ish)

Post

C++ is constantly in my way. I avoid all of its libraries, for the most part. They're terrible. I just make my own routines. It was actually faster for me to do my own double-linked list than to figure out what the hell C++ was doing.

If it was JUST K&R C with the addition of classes with auto malloc/release (cuz I'm lazy ;)), I'd be all over it, but they've made it practically impossible to just use that subset.

In the end, I'd rather just use structs and create my own C classes with memory macros to handle the new/delete bits.

/rant off I've been learning the Windows API this week...
I started on Logic 5 with a PowerBook G4 550Mhz. I now have a MacBook Air M1 and it's ~165x faster! So, why is my music not proportionally better? :(

Post

It was actually faster for me to do my own double-linked list than to figure out what the hell C++ was doing.

Code: Select all

#include <list>
#include <iostream>
#include <algorithm>

int main()
{
	typedef std::list<int> IntList;
	IntList ll;
	ll.push_back(3);
	for (IntList::const_iterator ii = ll.begin(); ii != ll.end();ii++) std::cerr << *ii;
	IntList::iterator jj = std::find(ll.begin(), ll.end(), 3);
	ll.erase(jj);
    return 0;
}
As you can see it's pretty simple if you quit that genus hircus attitude :lol:
~stratum~

Post

As an aside, tight loops in Java doing mathy stuff can compete with C/C++ in speed, so can be a viable alternative. If I Java, I stick with 6. If only they'd added proper closures and redid Swing with 1/10th the bloat... The only JVM language I've found that I like is Fantom. Simple and to the point.

I understand trying to add features to make languages safer from bad programmers, but really, they are just making them as unusable as possible. I don't need my compiler whinging at me about how strcpy is unsafe when I'm tacking ".txt" to the end of MY file name. :roll:
I started on Logic 5 with a PowerBook G4 550Mhz. I now have a MacBook Air M1 and it's ~165x faster! So, why is my music not proportionally better? :(

Post

syntonica wrote:I don't need my compiler whinging at me about how strcpy is unsafe when I'm tacking ".txt" to the end of MY file name. :roll:
That's C, not C++. C++ version is this:

std::string x("file"),y(".txt");
x+=y;
~stratum~

Post

stratum wrote:
It was actually faster for me to do my own double-linked list than to figure out what the hell C++ was doing.

Code: Select all

#include <list>
#include <iostream>
#include <algorithm>

int main()
{
	typedef std::list<int> IntList;
	IntList ll;
	ll.push_back(3);
	for (IntList::const_iterator ii = ll.begin(); ii != ll.end();ii++) std::cerr << *ii;
	IntList::iterator jj = std::find(ll.begin(), ll.end(), 3);
	ll.erase(jj);
    return 0;
}
As you can see it's pretty simple if you quit that genus hircus attitude :lol:
Complete gibberish! :lol:

I'm really crabby this week, so just ignore my tirades...
I started on Logic 5 with a PowerBook G4 550Mhz. I now have a MacBook Air M1 and it's ~165x faster! So, why is my music not proportionally better? :(

Post

quikquak wrote:I've always hated header files, but I've learned to live with them.
Use clang, it has modules instead of headers, and they should come in the standard for C++20.

Post

Z1202 wrote:So, one has the whole spectrum from almost machine-code level to high-level language features. One can think in any of these terms and be able express the ideas in C++. Thus one is simultaneously capable of constructing very complex architectures and/or write very efficient and predictable implementations, staying in control (still) of what's going on. And it saves you lots of typing :D
And they are starting (finally) to things natively, like threads and soon SIMD (instead of using intrinsics, so portable), so yes, I think the future is sunny again for C++. And with better memory management practices introduces with C++11, you don't have to worry as much about it and still do low level stuff.

Post

syntonica wrote:C++ is constantly in my way. I avoid all of its libraries, for the most part. They're terrible. I just make my own routines. It was actually faster for me to do my own double-linked list than to figure out what the hell C++ was doing.
Have you looked at the cppcon presentations? Especially those by Chandler Carruth, it should reconcile you with C++. It's always about using the proper container. list is usually never.

Post

Miles1981 wrote:
syntonica wrote:C++ is constantly in my way. I avoid all of its libraries, for the most part. They're terrible. I just make my own routines. It was actually faster for me to do my own double-linked list than to figure out what the hell C++ was doing.
Have you looked at the cppcon presentations? Especially those by Chandler Carruth, it should reconcile you with C++. It's always about using the proper container. list is usually never.
Heh. I needed something arbitrarily expandable. I could have just thrown memory at the problem and used an array large enough to handle extreme cases, but the list was faster, simpler and more elegant, despite creating and destroying the items. I suppose I could keep a pool of empties, but it hasn't proven necessary. It's actually the first list type I've ever had to use, but FIFO order was needed, as well as being able to remove items in the middle. Normally, I'm stuck with doing key/value maps. (Insert yawning emoticon here.)
I started on Logic 5 with a PowerBook G4 550Mhz. I now have a MacBook Air M1 and it's ~165x faster! So, why is my music not proportionally better? :(

Post Reply

Return to “DSP and Plugin Development”