Hacker News new | ask | show | jobs
by divtxt 5287 days ago
> He explains that the languages should have been merged into one, so that C would have been a subset of C++ instead of nearly a subset of C++.

Thank the stars this didn't & won't happen!

Bjarne has been stuck in "C++ is the best & only language anyone needs" long after the world has moved on to Java, C#, Python, Ruby, JavaScript, etc.

C occupies a sweet spot combination of:

- low-level with "no magic"

- small enough for most people to "hold in your head"

C++ matched these conditions for a brief time in it's life - the early 90s aka "Stroustrup 2nd edition" - when the only "magic" was basic virtual functions, and templates where just a promising experiment in an appendix.

4 comments

Here we go again...

C++ is used heavily from everything from Games, VFX programs (modellers, renderers/raytracer, compositors, paint programs), autopilot and control systems (cars, fighters (JSF), SpaceX are using it for their systems on their rockets), database systems, webservers, etc, etc.

There's a reason it is used a lot - in the real world it gets jobs done well by people who know what they're doing with it.

Saying "the world has moved on to Java, C#, etc, etc" is pushing it, given that the base system for many of those things are written in C++ (most of the native JNI stuff is C++, most Javascript compilers/interpreters are C++, many databases (Oracle, MySQL, MongoDB) are written in C++.

You may not like C++, and it might be difficult, and it may have worts, but thousands of people are using it very successfully for things no other language can do to the same degree overall.

My bad - "the world has moved on" was too strong.

I meant something like: other languages have risen in popularity because they are better than C++ for many types of projects.

Then again, browsers are written in C++ and so are almost all GUI apps. We spend most of our time with software that is developed in C++, probably for a good reason
so are almost all GUI apps

This claim is clearly false on Mac OS X and X Window platforms, and disputable on Windows, with the increasing share of .NET apps.

Please, name a .NET app that is widely used on Windows.
No it's not - there's a reason Qt is one of the most mature and well used GUI toolkits in the world by professional desktop software...
How is wide usage of Qt relevant to the claim that almost all GUI apps are written in C++?
"""This claim is clearly false on Mac OS X and X Window platforms, and disputable on Windows, with the increasing share of .NET apps."""

Actually it is not.

On OS X tons of programs, and especially the very largest, most popular ones, are in C++ (think: Photoshop and the Creative Suite, MS Office, and lots of Apple's own: Safari (webkit) is C++, Final Cut and Logic are C++, etc. Don't confuse the front-end UI code (Cocoa) with the backend. C++ is a first class language in XCode, and you can mix it with Obj-C as Objective-C++.

On X Window platforms: besides KDE, some of the most important apps are C++, including Firefox, Thunderbird and Open Office.

On Windows there are almost no .NET apps that people actually use --people as end users, as opposed to corporations. Most of the popular stuff, from games, to office suites, to design suites, to browsers, etc are C++.

You just proved the claim that there are many GUI apps written in C++ on OS X and X Window platforms, which is, incidentally, not the claim I find false. What I find false is the claim that almost all GUI apps are written in C++.
Can you find one app on your computer that is not written in c++?
Why, of course. What's more interesting, I can find only one GUI app on my computer that is (probably) written in C++, the web browser I use.

Why do you ask?

His argument is that if he's using a Mac, a lot of them are written in Objective-C.

And if he's using Gnome in Linux, most are written in C.

But for Windows apps, commercial apps, cross platform and games, C++ leads by far.

> long after the world has moved on to Java, C#, Python, Ruby, JavaScript, etc.

I don't think this is true for everyone. In fact I believe recently we have seen a renaissance of native code. C++ is the number one language for that. Those higher level languages waste a lot of cycles. You pay the warm and fuzzy feeling during development with performance and/or energy.

I used this argument for Java, but it's the same with C++.

If I can deliver a first version 2 months before the C++ version gets ready, I'll have two months to optimize market-tested algorithms before you hit the market. I may even have time to rewrite the sensitive parts in C.

If we are talking gadgets with embedded software, you may use a less powerful hardware and offer a cheaper product, but you'll have to amortize higher development costs and deal with a longer time to market.

For many things the world really moved on. C and C++ are still important, just not as important as they were a decade or two ago.

"""I used this argument for Java, but it's the same with C++. If I can deliver a first version 2 months before the C++ version gets ready, I'll have two months to optimize market-tested algorithms before you hit the market. I may even have time to rewrite the sensitive parts in C."""

Yeah, the only problem with that logic is that it never happens.

(Except in the server space, where it doesn't matter what language you're using to make your web app, and you can throw more server boxes at it to make it go faster).

1) Very few commercial programs are made with some dynamic language as opposed to C/C++, and none in the fields where performance matters (games, video, multimedia) etc.

2) Some do incorporate a scripting language, but for non critical layers (Lightroom for example uses Lua for its UI scripting, but all image crunching is in C/C++).

3) It's not like time to market matters that much. You're not building Facebook, you're building a desktop app. Chances are a lot more exist in the same section of the market.

4) """For many things the world really moved on.""" --care to give some examples of successful desktop apps not written in C/C++?

I'm sure you'll find 10.

I doubt you'll find 20.

Desktop apps are becoming a niche. I used to have an e-mail client, a spreadsheet, word processor, groupware, project management and an IDE installed on my machine. Now all I need is a browser and a text editor (although it's Emacs).

It still makes sense to use C/C++/hand-tuned assembly for high-performance things like game engines, 3D modeling, audio/video processing and so on. While my current OS is written mostly in C, I am old enough to remember (and have used) technically successful OSs written in things like Smalltalk, Lisp, PL/M and Algol.

Like I said, C makes sense for a lot of things. It's just not as important as it was 20 years ago.

"""Desktop apps are becoming a niche. I used to have an e-mail client, a spreadsheet, word processor, groupware, project management and an IDE installed on my machine. Now all I need is a browser and a text editor (although it's Emacs)."""

People say that, but I don't see it. The Mac App Store has sold millions of apps already. And the iTunes App Store has sold a BILLION native (non browser) mobile apps.

If you only need is "a browser and a text editor" good for you. I need: a media player, a text editor, a word processor, an IDE, a chat client, Evernote, Dropbox, Skitch, Photoshop, VMWare Fusion, and some other stuff besides...

> People say that, but I don't see it.

It all depends on where you look at. I can't remember the last corporate software piece I saw being delivered as a desktop application.

Stand-alone software for iOS has one advantage over web applications in that users sometimes face lack of connectivity. The Facebook app, IIRC, is delivered as a standalone app, but, in reality, is nothing but a web application. It's not alone and there are definite advantages to their approach. Most software appears to be entertainment - games, social thingies etc. They are the kind of games one would expect to be delivered as a Flash application within a brorser on a desktop.

I am not familiar enough with the Mac App Store, but, while there are some more "serious" offerings, in line with the desktop apps I mentioned, most of them appear to be, again, games and other entertainment related stuff. That and front-ends to net-centric applications such as Evernote.

> when the only "magic" was basic virtual functions

What's "magic" about structs of function pointers? This is a classic idiom in C, just given a specialized syntax in C++.

With that argument you could invalidate any high-level language construct. They're all just "specialized syntax" of classic idioms in Assembly.
Exactly. And nobody thinks that for loops are "magic".
No, but for loops are simple. Classes are not that simple. Of course, no feature really is "magic". But there are a lot of features that may be easy to use but hard to deeply understand. Take for example the attr_accessor method that Ruby uses to make variables pseudo-public. Most beginners coming from Java think that it is a language keyword, similar to "public". In fact, it just writes getters and setters for you. Of course, everyone could just write their getters and setters themselves, but this is just what language is: A way to abstractly tell a machine what to do. And if you don't know how it works (and maybe even don't need to know), you can call it "magic".