News for hackers. Stuff that matters.
Re:Thriving in a Crowded and Changing World: C++ 2006–2020 [... by exdsq on Friday July 16, 2021 @05:01AM (#27854329)
I've considered doing this - I spend so much time learning new languages that I am average in many but not an expert in one. However, when I look at what language to pick for that 'one', I can't decide. It's gone from Python -> Common Lisp -> Rust, etc... What are some arguments for C++ to be The One?
Re:Thriving in a Crowded and Changing World: C++ 2006–2020 [... by vnorilo on Friday July 16, 2021 @05:26AM (#27854472)
C++ has a great reach, from bare metal to very high level of abstraction. It can be squeezed to support almost any paradigm, oop to functional. You can make dynamic object systems, build a reflection system or a garbage collector. You can do compile time programming.

In general, a systems language is a great asset in your toolbelt. A high level one can let you shape your own environment to great detail.

In the end I think most systems languages will take you to a similar place. Many others have fewer footguns or better ergonomics than C++. Its distinctive feature/bug is having no opinion of almost anything. Or alternatively, you can find subcommunities with almost any opinion.

Re:Thriving in a Crowded and Changing World: C++ 2006–2020 [... by exdsq on Friday July 16, 2021 @05:52AM (#27854593)
But is it truly practical to use in 'higher-abstraction' apps like web or mobile? I mostly work in higher-level systems programming but dabble in most areas when I want/need to.
Re:Thriving in a Crowded and Changing World: C++ 2006–2020 [... by rramadass on Friday July 16, 2021 @06:17AM (#27854708)
>But is it truly practical to use in 'higher-abstraction' apps like web or mobile?

Yes absolutely. Once you become familiar with the language the barrier is not that high. Familiarity trumps everything else.

That said, since i am not a Web/mobile developer i had collected some resources to help me learn how to use C++ for Web/Mobile apps, you may find it useful;

https://levelup.gitconnected.com/cross-platform-mobile-and-w...

https://github.com/Microsoft/cpprestsdk

https://medium.com/@ivan.mejia/modern-c-micro-service-implem...

Re:Thriving in a Crowded and Changing World: C++ 2006–2020 [... by typon on Friday July 16, 2021 @10:29AM (#27856575)
Not really. If you want to do iOS development, there's no point in using C++. The Swift interop with C++ is very painful.

I think for Android development, the NDK support is much better and there you might be able to leverage C++ much easier.

Re:Thriving in a Crowded and Changing World: C++ 2006–2020 [... by vnorilo on Friday July 16, 2021 @08:40AM (#27855635)
I have been working on many mobile apps that would share a C++ model between iOS and Android, and use platform-specific code for views.
Re:Thriving in a Crowded and Changing World: C++ 2006–2020 [... by jahnu on Friday July 16, 2021 @07:16AM (#27855083)
Web and mobile is possible but anyone experience in both will realise c++ is only suitable for a minor subset of these.
Re:Thriving in a Crowded and Changing World: C++ 2006–2020 [... by rramadass on Friday July 16, 2021 @06:23AM (#27854737)
>Its distinctive feature/bug is having no opinion of almost anything

This single phrase has clarified the workings of the C++ standards body like nothing else; When in doubt, add it in!

Re:Thriving in a Crowded and Changing World: C++ 2006–2020 [... by jahnu on Friday July 16, 2021 @07:14AM (#27855073)
History shows this to be just plain wrong. There are many examples but for example look how long doubts about concepts held back that feature.
Re:Thriving in a Crowded and Changing World: C++ 2006–2020 [... by scott_s on Friday July 16, 2021 @02:54PM (#27859840)
This very submission is 160 pages documenting this very fact.
Re:Thriving in a Crowded and Changing World: C++ 2006–2020 [... by jahnu on Friday July 16, 2021 @04:44PM (#27860986)
Indeed. I have a lot of sympathy for the viewpoint that c++ is a very very complicated language in it's entirety, but not much sympathy for the idea that features are added willy-nilly.

It's a product of its time, massive success, and a herculean effort to retain backwards compatibility. It can be frustrating at times but I can seem to make great things with it still.

Re:Thriving in a Crowded and Changing World: C++ 2006–2020 [... by wly_cdgr on Friday July 16, 2021 @07:53AM (#27855323)
All the coolest problem domains (embedded/robotics, games, creative content creation software, systems) run on C/C++ and will for the rest of your career. If you dual wield C++ sword and Python dagger it gets even better (computer vision)
Re:Thriving in a Crowded and Changing World: C++ 2006–2020 [... by exdsq on Friday July 16, 2021 @08:38AM (#27855621)
Good point. I think the rust hype threw me off incase it's going to replace C++ but I do agree with GP in that it's probably going to be more like a C/C++ split.

This post has convinced me to look at C++ again. Last time I used it I got put off by the lack of dependency manager so linking things like Boost sucked. Any tips on a modern tool chain?

Re:Thriving in a Crowded and Changing World: C++ 2006–2020 [... by pjmlp on Friday July 16, 2021 @09:52AM (#27856225)
To pick on the sibiling comment, these are the C++ versions of crates.io.

https://vcpkg.io/en/packages.html

https://conan.io/center/

Plus they can also host binary packages, so you don't have to build the world, just your own stuff.

For some of us that matters.

Re:Thriving in a Crowded and Changing World: C++ 2006–2020 [... by tialaramex on Friday July 16, 2021 @12:42PM (#27858128)
They certainly are package sites, but they don't seem very like crates.io

I looked at random at the "quote" crate on crates.io and, since I've heard of it and it was on that front page, the "abseil" package from vcpkg

First thing I'm wondering is, is this the thing I thought I might need, or did I mishear somebody and I wanted a different thing? Crates.io provides me detailed information about the crate in one click. Yes, this is what I hoped it was, and here's a great description of how to use it. But on vcpkg there's a single line describing Abseil, and it's cut off for some reason with no indication how to read more. Maybe if I paid Microsoft money I'd know? No idea.

OK. Let's use assume we did want this, both are clear here, crates.io gives me the text to add to cargo to use quote in my program, while vcpkg tells me to invoke a slightly awkward command to get abseil, but either would become natural very quickly I'm sure.

Now, we need a bit more information. On crates.io in two clicks I'm looking at programming documentation for quote, explaining how I should use it with working examples. In one more click I'm reading syntax highlighted source code for the actual quote! macro, in case I'm curious how that works. I am suitably horrified, I definitely want somebody else to solve this problem for me.

But on vcpkg after a few moments with no idea I realise that the Octo-cat icon labelled "Star" is a link to a GitHub repo for Abseil, and this seems the only possible way forward. Alas, the GitHub repo also doesn't really document Abseil, but it does eventually produce a link to another third party site about Abseil, and on that site I get told to install Bazel, a build system that Abseil likes so that I can get "started" learning how to use Abseil.

OK, maybe Abseil is special. Not good news, but lets try something different. What does vcpkg have in the way of Hazard Pointers? It suggests libcds. We can again get to a GitHub, which provides us with a (HTTP) link to a doxygen doc site. Clunky but functional, at least it doesn't want me to install separate build tools. I could learn how to use this, although it lacks search and the examples are poor it is serviceable.

But you're right, vcpkg can include binary packages and so you don't have to build the world and if that is all that matters you're onto a winner.

Re:Thriving in a Crowded and Changing World: C++ 2006–2020 [... by pjmlp on Friday July 16, 2021 @01:21PM (#27858659)
I could reply about all the issues that make crates.io a non starter for many corporations, but then this would escalate into a Rust vs C++ and better not.
Re:Thriving in a Crowded and Changing World: C++ 2006–2020 [... by wly_cdgr on Friday July 16, 2021 @08:54AM (#27855716)
I'm very far from an expert, but Microsoft has been making some nice ecosystem improvements. Check out vcpkg if you haven't had a chance to yet
Re:Thriving in a Crowded and Changing World: C++ 2006–2020 [... by rramadass on Friday July 16, 2021 @06:09AM (#27854670)
See my other post in this thread for some reasons making C++ "The One" language to learn.

You mention;

>I am average in many but not an expert in one

This is exactly why i am always wary when people give me a long list of languages they "know". They may know the superficial syntax but not the commonly used "idioms" of the language which is what is necessary for fluent expression in the language. This takes time and effort which i would rather spend with a single language and try to truly "master" it as far as possible. The situation is exactly analogous to learning "Natural Languages". You may be fluent in one or a couple while knowing a few introductory phrases/expressions in half a dozen more.

Re:Thriving in a Crowded and Changing World: C++ 2006–2020 [... by mdpye on Friday July 16, 2021 @05:14AM (#27854401)
That it includes almost every possible feature ever posited in a language? /jk, sort of

It's kind of a double edged sword...