6 ms·
It's not about specific problems, but rather when you can't compromise on performance and still want to raise the abstraction level from C. There are up and co
by vinkelhake 12y ago
It's not about specific problems, but rather when you can't compromise on performance and still want to raise the abstraction level from C.
There are up and coming languages that can claim to compete in that area, but they're still rather immature and/or lack developer support.
- loup-vaillant 12y agoI'm afraid I must insist on specificity: no specific problem means no justification. I understand the abstract reasoning if we had to plan that we might need C++ in the future. But when you're choosing a language now, you always work on a specific problem. So, which specific problems requires you to both optimize the hell out of your CPU and memory, and mostly work at a higher level of abstraction than C? I'll go even further: C + <high-level language of choice> already competes on that front (abstraction + performance). On which specific problems are they not enough, and C++ is required? I'll go even further: there has been a number of C pre-processors spouting up recently. One of them does Lisp-like macros. Another does lambdas. Yet another might address templates. I predict a modern version of "C with classes", which learned from the mistakes of the past (like trying to be compatible at the syntax level). At that point, do you think there will be any specific problem where C++ is still the best choice?
- deleted 12y ago[deleted]
- falcolas 12y agoGame programming. AAA level games require high level performance which can typically not support interpreted languages. They also are complex enough that trying to program them in C would create more problems than they would solve. Granted, many indy games can work by using an embedded interpreter for much of the game logic, but it doesn't take much to run out of computing power at that level and still maintain reasonable (and consistent) frame rates.
- vinkelhake 12y ago> So, which specific problems requires you to both optimize the hell out of your CPU and memory, and mostly work at a higher level of abstraction than C? My sibling here already mentioned AAA game development. Finance is another area where top performance is often required. Performance is the requirement. Being able to work at an abstraction level higher than C is highly desirable. C++ gives you both of those. > I'll go even further: C + <high-level language of choice> already competes on that front (abstraction + performance). On which specific problems are they not enough, and C++ is required? You get a boundary between the "high level" and "performance oriented" parts of the code that is arbitrary and only exists because the high level language performs poorly. There are definite costs to that approach. > I'll go even further: there has been a number of C pre-processors spouting up recently. Cute hacks that are probably not suitable for production use. Let's be honest here. You're asking for problems that require the use of C++ now. The situation is surely going to be different in, say, five years from now - though I don't think it'll be a "C with classes".
- loup-vaillant 12y agoI believe Jane Street does High Frequency trading with OCaml. The other examples sound valid, though I have my doubts about batch processing (compression, crypto…). I intend to work an a serious C pre-processor this summer, after I'm finished with my Earley parser. This won't remotely resemble "C with classes". I won't aim for any syntactic compatibility, that was a silly requirement. Heck, I'll probably have Python-like mandatory indentation, reworked operator precedence, an overhauled type syntax, switches that don't fall through… But I will keep semantic compatibility, and a relatively obvious mapping to underlying C code. Coffe-C, not Clojure-C. But even that won't satisfy me. Eventually, I want to make a source-to-source transformation framework that can turn any language into any other. With that, languages become less of a programming interface, and more of an implementation concern.
- cgh 12y agoJane Street is not the only HFT firm out there, though you'd think so from reading the comments here. Most use C++ and Java. C++ is everywhere, from embedded to application software to games to the server side (Google has a gigantic C++ codebase). I worked on a camera that had its logic written in C++ and it wasn't some unusual thing.
- furyofantares 12y agoI think C++ is a fine choice right now for a whole lot of things, though in most cases I think C is also a reasonable choice and there are tradeoffs between the two depending on the goals of the specific project (rather than the type of project). So here's my list: A compression library, a crypto library, a numerical library, a video game, high frequency trading system, a high performance application server, a webserver, a database, a storage or caching system, an operating system, device drivers, a web browser, a VM, a programming language.
- thwest 12y agoIn C++ I can write a generic vector math routine that operates on any scalar type and still simd specialize it for particular scalar types.
- maaku 12y agoYou can do that in many languages...
- thwest 12y agoStatically typed i.e. without a inner loop dispatch penalty? Which others? I've considered an implementation in Fortran and OCaml as well. OCaml is attractive but doesn't cross compile to ARM officially. With C++ we can target x64, ARM and TI DSP with the same core processing module.
- maaku 12y agoHave you tried Haskell?
- deleted 12y ago[deleted]
- loup-vaillant 12y agoYou're not describing a problem. You're describing a solution, that C++ can implement.