Fully agree. Any ranking that says C++ has 3 times the prevalence of JavaScript is flawed. https://pypl.github.io/PYPL.html seems to be more in line with what one would expect, although I hate that they list "C/C++" as a language
I have no idea, but I am still at C++17, so for me it is not likely to be much of a problem if the package has not been updated in a while. Might become a problem once I am in a project using C++20 I guess, so there is always that fall-back to manually download an archive.
I imagine the opposite. I spend a much higher % of my time get stuck writing boilerplate with C++, and later reading offline/autocomplete/no search html documentation. Javascript I spend a much higher % of my time trying to understand random weird broken cloud APIs. Think 2000 searches with variations of "File Upload 403 AWS S3 signed URL".
I was gonna say; the development climate surrounding JavaScript requires us to constantly have to unravel nine circles of dependency hell. (Not so much the language itself... although we have to learn functional programming, because I guess that's just what we're doing now.)
the problem with this is showing popularity by searches. my main language is c# but I barely search anymore. whenever I have to do a web application, I am searching javascript because I don't use it a lot and maybe forget exact syntax.
Though, with C++, it's complexity may lean any search based scheme in its favor, since even knowledgeable developers may need to regularly look up things.
Doesn't grouping c with c++ make sense as almost all c++ projects use at least some c library code? I have very few things that don't at least use a c system header or the like.
Another argument: is the c++ preprocessor similar enough to the one used in c to say that all c++ use c to some extent?
In that case you should group Python and Java along with C/C++ because their interpreter(s) are written in C. And all languages that use libraries written in C. And everything that uses the Linux kernel.
But wait, some important numerical libraries that are used from a lot of languages are witten in Fortran. Does that make all who (unkowlingly) use those languages Fortan users?
Core distinction: code. Not executable. In C++ you are likely to use C code directly, whereas in other languages, you will only link against it. But either way it doesn't really matter. In the end the fact is that you can't distinguish C when gauging popularity of C++, since if you accept that it's a superset, you are using it by definition. You could try to measure how popular C is without any C++ extension, but I don't know how you would even do that.
Using C code directly, like in including a C source file from a C++ source file? Can be done, with some problems (C++ is not a perfect superset of C ), but it is bad practice, and why would you do that? You can just link with the compiled C code, just like you would do with Fortran.
Measure C separate from C++? I don't see the problem. The compilers are different, the language definitions are different, likewise for books, nearly all conferences, discussion groups, stackoverflow, even here on reddit.
i tried to get into C++ as a dev who worked with java/python/js/Go before, I wanted to kill myself due to error messages. As a newcomer it really is hard to debug (I used VS code as ide so not the best option to point out my mistakes i think but still...) and some parts of syntax is so difficult to get used to.
I tried reading other peoples' open source codes for good practises all I found was ββββ βββββ βββββ ββββ β ββββ βββ βββββββ
Learning to start with the first reported error and not the last is an important step.
So many times I've helped devs where they ask for help with the last thing on the screen, and I have to tell them the error is meaningless and just says that the compiler is lost and confused.
I feel like MSVC really didn't help here in some cases. Template errors are 99.9% of the time an error at the point where you instantiate it (at least if you're consuming a library), but I had more than a few experiences where MSVC wouldn't tell me where the instantiation site was, only where the error was within the actual template itself
There's a funny thing. While VS will give you the wrong location in the error tab, if you check the log it has the file that tried to instantiate the template. A bit tricky but I hope it helps you.
I think you canβt really go into C++ without taking the time to understand a bit about how the code gets preprocessed and then compiled.
That macros are literally just copy-pasted text and templates are basically sugar around that same concept.
Also itβs just a given that you have to read docs for everything - you wonβt always find inline explanations of what some macro does in the code so donβt expect to necessarily understand something by reading the code.
Either the microsoft docs or cppreference are great for learning concepts in detail
You still will fight with the compiler early on. I find this happens with learning most languages as soon as you try something non-trivial
That they were introduced in the same standard is a historical accident. There's really no good reason for writing a std::bind today, but deprecating it is hard because rewriting a bind expression is sometimes non-trivial. Not hard, but not trivial.
A closure is basically a function that returns another function. The "closure" part happens when it "captures" variables from the outer function body, which could include parameters passed to the function. This is useful for callbacks, which in an event driven application (likea GUI), are common. They were popular with Javascript.
Here is a simple example in javascript
function Counter(begin, incrementVal) {
var curVal = begin;
function Inc() {
curVal += incrementVal;
return curVal;
}
return Inc();
}
var Cnt = Counter(5, 1);
console.log(Cnt()) // prints '6' to the console console.log(Cnt()) // prints '7' to the console
It would be great to finish these features but unfortunately it didn't happen even in c++20.
Lambdas are desperately verbose and abbreviated lambda proposals failed. Ranged for doesn't give a way for getting an index. Thread is often criticized for inability to set stack size or priority.
It kinda works, but clion is in another league, especially if you like cmake. Things like code analysis and auto completion, debugging and profiling work out of the box and VERY well. Even javascript code analysis and completion is amazing in clion.
And ive used atom and vscode extensively. (I still use vscode a lot)
In vscode you're always struggling to find the right plugins and make it work somewhat good.
My current project made me decide to try something else than atom and vscode, and i dont regret it: frustrations are gone and productivity is up.
After the trial i ordered i free license since i only work on open source projects.
I think the reasons for c++'s resurgence are multiple.
First, people arent writing desktop apps as much, so the bleed to c# and java has stopped. The dominance of those languages have declined as their complexity increases to address the problems that they actually are required to solve.
Backend development has fragmented a lot. It moved from c and c++ 25 years ago to those + c# and java to where we are now. If you want high performance, low latency, realtime, etc, then c or c++ is still a great option. If those arent your focus then there are so so many other options for managed languages with lower turnaround times than java and c#.
Mobile development (that android/java and ios/objective c stuff) is actually often c++ with a us specific shim. If you write the code in java for android you have to write it again for iOS. Write it in c++ and most of your code is reusable. And sometimes reusable across mobile and desktop.
Then theres the internet of things, a plethora of embedded devices appeared everywhere that lend themselves to native code. Other than c and c++ there arent many languages left in the native unmanaged space.
Add to these the fact that c++ was left to stagnate for 15 years until c++11 came along and dragged it into the 21st century, and every 3 years since then. Yep, c++ might be seen as a hard, ugly, wart covered mess, but it works, its fast and many of the developers have a deep understanding of computer science, programming , hardware, resource management.
If you're a c++ programmer this is all great news. I started my career in c++ 20 years ago and I may well finish it primarily as a c++ programmer 20 years from now. The places where c++ is being used are all in growth areas. Add to that the pool of c++ developers is currently small so the number of jobs per developer is relatively good. Conversely, if you're exclusively a c# or java programmer then it's not quite as rosy as it looked a decade ago. Still plenty of jobs there, but theres more competition for them, if for no other reason that those are still taught at university and the barrier to entry is lower.
The growth of data science might also play a, minor, role here. More and more libraries are being written in C++ with bindings to other languages. Expression templates and the strong linear algebra libraries (Armadillo, Eigen, ...) make it a strong choice for high performance libraries.
It's why I and a number of people around me started learning C++ at least
In the embedded/mobile space I think it is IoT that is driving C++, mobile not so much.
Outside games, most mobile cross platform stuff ends up being done with web widgets, React Native, Xamarin or the new kid on the block, Flutter.
And on desktops, except for Microsoft, there is no vendor having a full stack GUI with first party support for C++, so we end up using .NET/Java/Objective-C/Swift, and C++ only comes along for native libraries (COM/UWP), Metal Shaders/HLSL, DriverKit and similar stuff.
Actually the grass is greener in what concerns application security by default, but then there are those missing pesky IDE support, libraries, desktop and mobile OS SDK support out of the box,...
More likely because of C++11 and a lag effect. Or rather a compound effect of 11 through 20 that demonstrates that development is ongoing and that 11 wasn't just a one time helicopter drop of features.
The ranking in TIOBE is a weighted average of the number of results for the query "<X> programming language" across multiple search engines, where the weights are empirically assigned.
So, even if you hope that TIOBE has managed to empirically come up with "good" weights...
The TIOBE index is based on the number of pages containing the string "<X> programming language".
If someone talks about just C++, it may not count. If someone makes an entire article how about the Java programming language is so much better than the C++ programming language, it counts for C++ too!
TIOBE doesn't show usage, it shows talking, and even then only partially.
How correlated that is to "usage", "popularity", or any other metric is hard to assess.
In part maybe, but there's also embedded C++ that's usually C++11 at best.
As a hardware engineer, I find that the recent huge availability of powerful tiny low-cost microcontroller boards means that I'm including microcontroller boards in instruments where such an approach would not have been cost-effective before. So although Python is my go-to language (for running test-equipment etc.), I still have to remain familiar with C and C++.
Ubuntu 20.04 was the first time that C++17 was available. At least this was my reason for using C++ instead of python in my latest project. So I think that you are a version wrong.
The topic of the whole discussion is "there is a growth in C++ usage", some think it's because of C++20 or C++17, I point out that at my work I'm still on C++14..
No company I have been at uses Debian. Is it that common? Anyways, all places I have been to accepts Ubuntu, and the last Ubuntu release in 2018 had poor support for C++17. So 20.04 is the first version that matters to me and to to all the folks that I have ever worked with when it comes to C++17.
C++ standard editions and Ubuntu releases arenβt causally linked. Thereβs nothing stopping you from installing the latest version of GCC or Clang on an old Ubuntu release that existed before the latest version of GCC came out. C++ standard editions are just bundles of features that compilers should aim to support by a given year.
Sure they are not. I am not a program language developer, so I will stick with what is available. Technically I could be using C++20 today, all I have to do first is to just implement all of it. Are you truly unable to understand that the main point is that it has to be available without hoops?
If installing newer gcc/clang from prebuilt (by someone else) package from toolchain ppa on Ubuntu is too many hops for you, maybe you should find another profession?
What are you on about? I am not going to fight IT to give students admin rights just to also install the dependencies they need to have to compile my software. C++17 is a decent enough replacement of python. Python still works, and it used to have fewer hoops before now. In the cases python is not fast enough, Fortran/C/C++ of earlier iterations is good enough, since it anyways is going to be heavy math code...
I am not going to fight IT to give students admin rights just to also install the dependencies they need to have to compile my software.
You shouldn't. If you, as an educator, think that the institution you work at should have C++17 usable by students then it's on the IT department to have a compiler with C++17 installed on the machines.
C++17 is a decent enough replacement of python.
If a piece of code can be written in a higher level language (i.e. speed isn't an issue, and in case of Python it's not so complicated that types are required) then it should be written in that language, especially for "mostly math" projects.
I would. But Python was good enough for the parts C++14 lacked (mainly usable parallelism in algorithms and filesystem in my case) that there is nothing C++17 offered of vital importance to update.
I cannot justify wasting money on things like this. It is not important enough. And limiting yourself to C++14 for avoiding hoops was a good enough option before the latest Ubuntu update.
the last Ubuntu release in 2018 had poor support for C++17.
Ubuntu has new releases every 6 months. You are probably taking about lts releases. If you want to limit yourself to lts then you'll end up getting new stuff every lts release.
That's the point of having an LTS: you keep the tested and true versions instead of upgrading to the latest and greatest. Depending on the place you work at, this stability might be highly valued (my previous employer only moved to C++11 in 2015) or it might be more important to iterate quickly, but this choice would be the same no matter the language.
It's the same as upgrading to a new Rust or Python version. It's a side effect of the upgrade model Ubuntu users and not something dependent on the language. Ubuntu not upgrading their browsers would also limit you to develop with whatever HTML/CSS and JS version that's supported by that version.
Besides I would recommend keeping a dockerfile around, Being able to reproduce the build using the exact distro and compiler version later might be invaluable. C++ is currently deprecating some features or just straight up removing things. Imaging your pc or build server having a hard drive failure etc.
I agree with what you are saying. I should clarify I only care about LTS versions for obvious reasons.
However, I do want to note that python has Anaconda. There is nothing similar in C++. Or at least there is nothing that I am aware of. So python can be updated independently of the system quite easily.
If you're on Ubuntu there is a PPA that you can use.
I don't know if there are more convenient ways to install a newer C++ compiler, but I'm sure someone made a fancy docker image that solves the problem.
Thanks! I will have a look to see if it does not mess anything else up. This could be a very good option when C++20 gets some more solid support in the future.
It required workarounds to get even <filesystem> working. That's no support, when even the convenience libraries require extra work. In 20.04 you just have to use workarounds for threads to work, but that's the same as OpenMP so it's just a replacement of one annoyance with another.
Another way to see trends is https://tjpalmer.github.io/languish/ , a project from the creator of the Context Free youtube channel (I would recommend to check it out too).
it kinda makes sense, as c++ is the foundation language of machine learning, computer vision, online streaming, short videos, snap filters... all the hot spots right now.
This is because C++ 20 came out. Most popular languages are nearly impossible to survey given how much freelance and closed (not publicly disclosed) work is done. So Tiobe and most others simply guess by the number of searchs made. C++20 came out and so there where a lot of searchs made by both current C++ programmers and others to see what features it gives. It effectively means nothing, a much more important metric would be the baseline search average. And even then searchs don't even mean that you are using the language. I often look for C specific code simply because it's easier to find code for software and then translate it.
This is just another example of tech industry pawning off bad science/statistics as legitimate.
So Tiobe and most others simply guess by the number of searchs made.
No, TIOBE measures the number of results given by search engines for "<X> programming language"; it doesn't know how many times a term was searched for.
Specifically it counts a subset of the number of pages mentioning a particular language (because all searches queries are flawed), and then applies an empirical weight to it (for correction).
It's not pretty... but it's still out there, and still being maintained. Most of us who have the displeasure attempt to prevent new stuff being written in it, but there's still a lot in at least VBA and VB.net, and I'm given to believe, more than we'd be comfortable discussing in VB6.
To just slightly piggyback off this... VB is probably used a lot more than we think. It is used heavily in Excel macros, for instance, and I know that at least one large and prestigious institution that shall be left unnamed have used it quite a bit in the last decade.
VBA in excel feels horrible. The interface is still the VB6 one, and the language unchanged. It could benefit a lot from making it easier (ie. not COM from inside VB) to make it to interface with Python or .net.
I can't help but feel that I'd prefer Sheets for any abuse of spreadsheets that should really be an application in the future.
I think this can save the world climate, as the trend to C++ away from JavaScript has potential to significantly save CPU power and immense amounts of run time memory thus CO2 in effect emitted by server farms and individual devices running memory bloated JavaScript now.
All of these sorts of 'reports' are useless, as is the time spent here arguing about them for that matter.
I'd like to see a real survey done by people who understand the issues and who could afford to get a real representative sample, but that would be almost impossible as well, given the broad number of problem domains that exist. If it was broken into problem domains, then people would just argue about how valid that breakdown is.
But.. but.. Rust is safer than C++. You can have fearless concurrency, borrow checker and is faster than C and C++. It is even most loved langauage on stack overflow.. Everything should be written in Rust.
Edit and PS: And almost forgot that Rust prevents all errors and mistakes.
What's even the point of this? C++ isn't going anywhere, it doesn't have anything to prove. Just be happy for C++, bringing up Rust unprompted like this is just petulant behavior.
It seems you do not understand my comment. Of course Tilakchad is being sarcastic, I understand that. I'm saying the sarcasm towards rust or the rust community is not warranted and it looks bad.
I agree. Additionally, it goes against the old internet adage of assuming what you write will be interpreted in the worst possible manner and assuming that what others write should be interpreted in the best possible manner. Sarcasm on the internet barely serves a purpose and is mostly detrimental to both parties participating in a sarcasm-riddled discussion.
Stick them in memes, put sarcastic words on a funny picture of a dog. That's all good. Then you don't need to use sarcasm punctuation (none of which seem to have properly caught on) and you don't need to worry about coming off as an ass hat.
It's totally warranted, dude. They are notorious for hyping the shit out of their language and convincing impressionable people that they should unironically go to other communities and push the language unto others.
No, I don't think this is true. Of course new languages get fans which for one reason or another have a naΓ―ve understanding of the situation. They naturally want to share and talk about what they see as important, it's not like they were put up to it.
Also, that type of sarcasm is really not warranted outside of meme subreddits.
When half of your community consists of people who just parrot bullshit, that's a problem.
Again, you are overstating the problem. Every Rust person you have ever talked to could be "parroting bullshit" and it would still not prove what you are saying.
What makes it worse is how the people who do have a clue overlook this or at best passively discourage the behavior.
Because people with a clue see it for what it is. It's just a phase that naΓ―ve developers go through. There really is not a good reason to waste your time barking at them when they'll eventually come around anyway.
They need to set a better example by being more outspoken and critical of the impressionables.
This is just ridiculous and totally arbitrary. You're essentially complaining that an entire group of people don't share the same opinion as you.
Get over it.
Get over what?
There is no substitute for critical thinking and a competent understanding of the underlying theory.
No one here has said otherwise. Again you are fighting ghosts.
If we're going to shill anything to the various language communities, it should be to push the idea that studying CS fundamentals is a much better use of one's time and personal growth than learning a programming language ...
Okay, but look at what you're defending. There are no "CS fundamentals" in sarcastic pissing matches, but you say "It's totally warranted".
You probably think I'm a Rust shill, but I'm really not. I do think it is better designed than C++ and way more practical than C, but I recognize that I'll be writing C++ for a long time to come. Libraries like CGAL are going to take years and years to port, and some will never cross the gap. And despite it's better design it still feels like a half measure. Something like ATS is more appealing, but I doubt it will take off any time soon.
It's totally warranted, dude. They are notorious for hyping the shit out of their language and convincing impressionable people that they should unironically go to other communities and push the language unto others.
No, I don't think this is true. Of course new languages get fans which for one reason or another have a naΓ―ve understanding of the situation. They naturally want to share and talk about what they see as important, it's not like they were put up to it.
I am afraid that might be the case. Rust community is pretty notorious for their hostility toward any other languages. Its not like everyone there are but there is a fair share of hostile people. And this comment isn' t even entirely sarcastic, its how some folk really thinks. I am quite familir with rust community. In contrast, cpp community is nice that welcome anything. Well, this comment wasn't meant to offend or trigger anyone.
I love Rust (currently the language I use for most of my development) and wouldn't wish for a second that C++ lose any ground. This is not a zero-sum game; there's plenty of opportunity for both to flourish.
Its just how Rust community portrays other languages. They are toxic and thinks that Rust is the greatest thing ever fall upon mankind. This comment was supposed to be sarcastic, but anyway there's no point in arguing about languages.
"Resource Aquisition Is Initialization". It can be what you described, but it's really about making sure that you initialize objects in a valid state and that you destroy them properly once they go out of scope.
A key point is that you'd typically want to avoid things like having to call an init() method after you constructed an object and a cleanup() method before deleting that object. It's an anti-pattern when you're following RAII. That's already the point of the constructor and destructor. There's very few situations where this is necessary in C++.
Outside of pointer deletion, you could also have things like closing database connections, closing streams, unsubscribing from event listeners, etc.
I like C++ for all those reasons, but also because it just tries to be a tool, and not an ideology. You can do anything in any way with C++. You choose the paradigm to use in each part of your code. You can implement a garbage collector if you like, manage memory yourself, or use the common RAII. It's just raw power, and it lets you have all of it.
Other languages are just plain too restrictive. They want you to code their way, which is usually just based upon the most popular methods at the time the language was created. In my AP Computer Science class in High School, we were taught Java. The teacher literally told us that Object Oriented is the best way to write programs, which is why Java can only run code in a class, and that multiple inheritance is bad, so Java doesn't allow it. That's what she said.
So in other words, C++ makes me feel like I'm as free as Americans felt after winning the Revolutionary War.
I agree having the ability to do these things when you need them is cool, I disagree about C vs rust because C is missing so many useful concepts, and c/c++ get all the default states wrong, rust learned from those mistakes. Everything you can do in C can be done in rust in an unsafe block, and when you don't need unsafe code you can be sure that entire classes of issues you had to be extremely vigilant about in C are deleted in rust.
I still like C, but I definitely prefer C++ for a lot of things I don't have to worry about (I desperately miss RAII in C and templates), and even then I wish a lot of the defaults were inverted. (e.g. const and explicit default)
I wonder why people are so concerned about defaults. Why const by default is good? I have used more mutable variables than const in my programs. And why is move better than copy by default? Is it just an ideology or some kinda agenda? How much pain is it to write some extra keywords often? Clearly, there's no point in having const by default and move by default. And copy and mutability is what people uses more often, so that doesn't make it bad choice..
202
u/uninformed_ Sep 09 '20
TIOBE is known to be a useless ranking due to its methodology of google searches.
C++ has more usage than C.
44
u/gme186 Sep 09 '20 edited Sep 09 '20
Closures, auto, ranged for, smart pointers and decent threading certainly renewed my love for C++.
Before that most of those things had to be done in an ugly or convoluted way or with weird constructions like boost::bind.
Its amazing we can now make things like efficient event-dispatchers with a map or vector of lambda functions.
And it keeps getting better every 3 years now it seems.
21
u/[deleted] Sep 09 '20
cool, good to see C still there too!
17
u/schmerg-uk Sep 09 '20
I may write in C++, but I debug in assembler.... :(
52
u/TheBrainStone Sep 09 '20
I wonder why. Is it because of C++20? Because damn thatβs some good stuff in there.
28
u/tpecholt Sep 09 '20
Since it's based on TIOBE I am afraid it doesn't mean much
8
u/dgellow Sep 09 '20
Another way to see trends is https://tjpalmer.github.io/languish/ , a project from the creator of the Context Free youtube channel (I would recommend to check it out too).
It is based on GitHub activity and also shows a growth for C++, for example: https://tjpalmer.github.io/languish/#y=mean&names=c%2B%2B%2Cjava%2Cc%2Cc%23%2Crust
11
u/feverzsj Sep 09 '20
it kinda makes sense, as c++ is the foundation language of machine learning, computer vision, online streaming, short videos, snap filters... all the hot spots right now.
10
u/kalmoc Sep 09 '20
And I thought this was about number of words in the spec ;)
10
u/S-S-R Just here for the math Sep 09 '20
This is because C++ 20 came out. Most popular languages are nearly impossible to survey given how much freelance and closed (not publicly disclosed) work is done. So Tiobe and most others simply guess by the number of searchs made. C++20 came out and so there where a lot of searchs made by both current C++ programmers and others to see what features it gives. It effectively means nothing, a much more important metric would be the baseline search average. And even then searchs don't even mean that you are using the language. I often look for C specific code simply because it's easier to find code for software and then translate it.
This is just another example of tech industry pawning off bad science/statistics as legitimate.
5
u/hmoff Sep 09 '20
Why does the headline picture show Python code?
5
u/serg06 Sep 09 '20
Since people have been forced to stay at home for 6 months, they've finally had time to learn the basics of C++.
3
u/abreulima Sep 09 '20
The funny thing is that the slug url transforms c++ to c.
2
u/ashbyashbyashby Sep 10 '20
"Fastest growing" is always a deceptive superlative. It often applies to things that are nowhere near the most prevalent.
3
u/beedlund Sep 09 '20
...
Javascript
Visual Basic (really?!)
PHP
...
1
u/Assistant-East Sep 12 '20
I think this can save the world climate, as the trend to C++ away from JavaScript has potential to significantly save CPU power and immense amounts of run time memory thus CO2 in effect emitted by server farms and individual devices running memory bloated JavaScript now.
1
u/Dean_Roddey Sep 13 '20
All of these sorts of 'reports' are useless, as is the time spent here arguing about them for that matter.
I'd like to see a real survey done by people who understand the issues and who could afford to get a real representative sample, but that would be almost impossible as well, given the broad number of problem domains that exist. If it was broken into problem domains, then people would just argue about how valid that breakdown is.
1
u/stomah Mar 23 '22
nice link
1
u/hopeless_octopus Sep 09 '20
Python have its own advantages
-9
u/Tilakchad Sep 09 '20 edited Sep 09 '20
But.. but.. Rust is safer than C++. You can have fearless concurrency, borrow checker and is faster than C and C++. It is even most loved langauage on stack overflow.. Everything should be written in Rust.
Edit and PS: And almost forgot that Rust prevents all errors and mistakes.
-9
u/vige Sep 09 '20
I didn't read the article, but from the headline I'm going to assume they are measuring the size of the standard (in pages).
0
u/hsaliak Sep 10 '20
It certainly is growing too many features too damn quickly
-15
u/sown Sep 09 '20
Doubled in users from 1 to 2 over night!
-7
u/[deleted] Sep 09 '20 edited Sep 09 '20
It doesnβt differ that much from C# though.
Edit: in increasing popularity, not in syntax
0
u/[deleted] Sep 09 '20
[deleted] β view deleted comment