C++ will be around for at least the next 100 years. It's an ISO standard used by business and government all over the world. Modern C++ is very safe and fast too.
100 years is a long time in technology. A safer bet would be to say "Assembler will be around in a 100 years". High level languages tend to get replaced after a while.
Does C++ still deserve a bad rap?
221–230 of 310 posts
Re: Does C++ still deserve a bad rap?
#222Earlier quoted context omitted.
OCaml is quite a lot more pragmatic and 'loose' than Haskell. But that's just my impression. They even have for-loops in OCaml.. (I would be really slow writing code in vanilla JavaScript. There's no static checking, and not much dynamic checking. So you need to watch your step very carefully---in some sense, very much like in C++.)
> OCaml is quite a lot more pragmatic and 'loose' than Haskell. But that's just my impression. Mine too. I still dislike the lack of Unicode strings by default, and the somewhat confusing tooling (initially) but outside of that I quite love the language. It has a huge potential and I can only hope that the arrival of Multicore to the upstream language will kick it forward and put it in the same league as Rust (althou…
Well, in theory GC can be made very fast. Though you sort-of have to decide whether you want maximal throughput or real-time latency guarantees.
In practice, we aren't quite there yet, alas.
The way to get really fast code is just to avoid allocation, I'd guess? OCaml allows you to use mutation, and it's relatively easy to peak under the hood to see what your code gets translated into.
The main technical innovation of Rust is the borrow-checker.
But that piece is very related to linear types / uniqueness types. There's some interesting work going on with linear types in Haskell.
And just like Generalized Algebraic Data Types also eventually made their way to OCaml, there's no fundamental reason they couldn't add linear types to OCaml, I guess?
(Linear types can basically be used to encode the FP equivalent of manual memory management.)
Re: Does C++ still deserve a bad rap?
#223Like every programming language out there, C++ is a tool. And like every tool out there it has its uses. There isn't any point of using C++ to count words in a text file. Any high-level language like Python will beat you to it. However, there's one thing you can do in C++ and not in Python or JavaScript or PHP: fully control the memory layout of your data. While you don't need it in most of the cases, it becomes a ki…
> There isn't any point of using C++ to count words in a text file. Any high-level language like Python will beat you to it. People using c++ usually care about programs finishing before the heat death of the universe. I had a few Python scripts that spend several seconds parsing larger files, after a rewrite to c++ that changed to almost instant.
Was it worth rewriting those scripts in C++? I'm not trying to be facetious; a few seconds (or minutes) of additional runtime for scripts you hardly ever run or even run only once doesn't really matter, but running such scripts often may then worth the effort to convert them to something faster.
I regularly find myself porting regularly used python/js scripts to C#/dotnet (because it's fast enough, has good collections + LINQ for your somewhat-functional-programming needs and I can skip manual memory management, and async/await programming is not perfect but available and easy enough, + nuget has a lot of stuff and so does the standard lib).
What made you pick C++ over e.g. go or rust or C#?
Re: Does C++ still deserve a bad rap?
#224It's unfortunate that the compilers don't automically turn on -werror, -wall and other useful flags that can help alleviate lots of arcane issues. I also think the tool maintainers do a poor job of promoting the use of UBSAN, ASAN, TSAN, etc. If you watch talks, you'll learn about these tools that solve most headaches, but you have to be so in the know to be aware that these tools exist. You have to dedicate time outside of working hours to really absorb all this information and imo that's unacceptable. Other languages put a larger effort towards making their tooling easy to use and provide amazing documentation (c# is the best at this imo). I'm a c++ dev and I love it in a masochistic way, but if these issues aren't addressed rust will eat c++'s lunch.
Re: Does C++ still deserve a bad rap?
#225C++ fills a niche and probably if you use it all on your own you don't even see the problems. But if you use it at scale with multiple developers you can see it's layers of leaky abstraction laid down since the 80s that can never really be cleaned because too much is built on this foundation. This slightly over 100 page book on move semantics https://leanpub.com/cppmove shows some of the iceberg like complexities dot…
100x this. If >90% of your serious coding is in one language, you'll become desensitized to its bad parts but you'll be hyper sensitive to anything that seems inconvenient in any alternative. I've seen this over the years with Fortran and C coders. C++ coders do it to C all the time. Lisp coders are notorious for it. It's Selective Perception 101, counting the hits and ignoring the misses. We're all prone to it, and have to correct for it.
If you really want to compare any two languages, you have to give both a more than casual try, and keep an open mind throughout. Otherwise your conclusions are likely to be unhelpful at best.
Re: Does C++ still deserve a bad rap?
#226Earlier quoted context omitted.
By using libcurl. I run a distributed c++ database and it's one of the most stable components of our stack. Java and Ruby tend to break much more often. Also, you wouldn't want to use Python without any packages, so why insist on the same with c++?
Is there some sort of standard / commonly accepted way to manage packages for c++? In python its as simple as pip install + import, and the community is generally in agreement with the best library to use with good documentation. Is there some sort of similar tools I can use for c++?
[1]: https://github.com/microsoft/vcpkg [2]: https://conan.io [3]: https://github.com/cpp-pm/hunter
Re: Does C++ still deserve a bad rap?
#227I have nothing against C++ per se. Used it on and off for 10 years (but most actively 3). It's a fine language. To me using C++ means you are ready to give up a lot of time and energy in order to gain a complete control over certain aspects of your program. I was very much into that at the start of my career and gradually started drifting away to more immediate productivity while reserving the right to poke under the…
I used to work with C++ almost exclusively, but accepted to use more interactive languages for most of my work mostly for faster iteration. C++ is definitely not my main choice anymore, but still use it daily. C++ has pretty much unmatched tooling due to the massive ecosystem. I have my own long list of gripes against it's syntax and historical baggage, however it's a language that doesn't really impose a style/idiom…
I have now worked with Rust for a year, and I don't see myself ever going back to C++. The statement in the article that "only the final iteration would be unsafe if one would forget to check the length" made me cringe uncomfortably. I might have written similar code as the author, but it now looks clumsy and overly complicated.
Re: Does C++ still deserve a bad rap?
#228I've never actually had a problem with c++ grammar or syntax or logic What I do have a problem with is trying to interface with more complex apis and functions. For example a while back I had to implement a https get and post request and it was a total nightmare. Something that takes only a few lines in python took a few days to figure out. Maybe it's lack fo experience but I tried wrestling with libraries like pocco…
Re: Does C++ still deserve a bad rap?
#229My beef with C++ is with its dependency (non)management. For almost every modern language, you can easily build and run code - pull code from repo, run the included script or standard command to get the dependencies and build it, bam, you're done without needing to know much about that language. With C++ it seems like half of the time pulling someone else's old project from github and running make (or whatever the au…
The dependency manager for C and C++ is called apt-get.
Re: Does C++ still deserve a bad rap?
#230Like every programming language out there, C++ is a tool. And like every tool out there it has its uses. There isn't any point of using C++ to count words in a text file. Any high-level language like Python will beat you to it. However, there's one thing you can do in C++ and not in Python or JavaScript or PHP: fully control the memory layout of your data. While you don't need it in most of the cases, it becomes a ki…
> [...] fully control the memory layout of your data. Is that actually guaranteed by the standard? > * Try doing anything non-trivial on a microcontroller with 32KB of RAM. You could theoretically use a higher-level language, but you will end up using >10x amount of RAM. It's a shame Forth never took off. Sometimes I wonder what it would have been like to live in an alternate universe where Forth had been the lingua…