Live data from Hacker News

Does C++ still deserve a bad rap?

nibblestew.blogspot.com

101–110 of 310 posts

Re: Does C++ still deserve a bad rap?

#101
C++ 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 dotted all over the place. Some developers probably never use and have never even heard of move semantics.

I've been programming in C++ pretty much my entire career. Personal projects or small projects I'd use Ruby or Python first. I'd only ever use C++ (or a very specific subset of it) if I want to make something extremely performant.

C++ will eventually peak and die off but the timeframe is probably measured in decades and I'm sure there'll places where it holds on even then, like Fortran today. I certainly would't recommend it to a programmer starting out today, instead C or Rust would be better places to get an idea of system level programming.

Re: Does C++ still deserve a bad rap?

#102
post #4

Earlier quoted context omitted.

Because it doesn't even exist as provided functionality; you have to code basic stuff like this yourself. See for example https://stackoverflow.com/a/14267455

It is possible with a regex iterator #include #include #include int main() { std::string s = "Python*C++*Java"; std::regex regex("\\*"); std::vector out(std::sregex_token_iterator(s.begin(), s.end(), regex, -1), std::sregex_token_iterator()); for (auto &s: out) { std::cout

Hey just curious i have only coded c++ in school I’m curious to know why don’t we use `using namespace std;` in real world when writing c++

Re: Does C++ still deserve a bad rap?

#103
post #88

Earlier quoted context omitted.

it depends on what you're doing of course. It can even go the other way[1] Generally languages like C++ are obviously much faster, but a lot of primitive stuff in languages like python is also just C calls and may be optimised to the point of being faster, because doing things in low level compiled languages often comes with its own tricks and problems. [1] https://stackoverflow.com/questions/9371238/why-is-reading-l…

> but a lot of primitive stuff in languages like python is also just C calls and may be optimised to the point of being faster That assertion makes zero sense if we take into account that parallelization is one of the most basic performance techniques there is, and Python's GIL simply eliminates that option except for multi-process applications which then require serializing stuff back and forth. Python is pretty muc…

The overwhelming majority of C extensions release the Python GIL during calls to them. If you're in the situation described in the parent comment then you can parallelize just fine using threads.

Re: Does C++ still deserve a bad rap?

#104

Isn’t c++ heavily used in financial industry and hedge funds

Yes... check out this repo: https://github.com/bloomberg/bde, a very powerful library developed by Bloomberg.

A random example: https://bloomberg.github.io/bde-resources/doxygen/bde_api_pr...

Re: Does C++ still deserve a bad rap?

#106

Earlier quoted context omitted.

> 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. Any books or resources for digging deeper in these kinds of topics? I’m a Python developer and would like to learn C++ but the just the reasons you mentioned make i…

Python developer here just switched jobs to one that does C++. Let me warn you right now. It's not worth it. At all. Don't go down this path. Memory management is easy, but that's not the only crap you have to deal with. Templating and the whole C++ ecosystem with Cmake compiling to make is a giant headache. It takes about a week to integrate a new C++ library in source code and people are worried about installing or…

It just sounds like you are working on a big messy project.

Re: Does C++ still deserve a bad rap?

#107
post #2

I say this with a lot of love for C++, and I think it has gotten much better, but just try splitting a string via another string as the delimiter...

Is there any language where string handling doesn't suck? (No script languages please, because they cheat by implementing the hard things on C or C++) From memory the less horrible experience i had was with Go, but there's help for the slices on the runtime which let the difficult parts hidden and also the batteries-included std library, which is one of the most well designed standard libraries out there. Buffer mana…

> implementing the hard things on C or C++

This misses the point. I don't care how the language implements the functionality if it meets my performance requirements and it is convenient to use.

Re: Does C++ still deserve a bad rap?

#108
post #88

Earlier quoted context omitted.

> but a lot of primitive stuff in languages like python is also just C calls and may be optimised to the point of being faster That assertion makes zero sense if we take into account that parallelization is one of the most basic performance techniques there is, and Python's GIL simply eliminates that option except for multi-process applications which then require serializing stuff back and forth. Python is pretty muc…

The overwhelming majority of C extensions release the Python GIL during calls to them. If you're in the situation described in the parent comment then you can parallelize just fine using threads.

[deleted]

Re: Does C++ still deserve a bad rap?

#109

Earlier quoted context omitted.

Python developer here just switched jobs to one that does C++. Let me warn you right now. It's not worth it. At all. Don't go down this path. Memory management is easy, but that's not the only crap you have to deal with. Templating and the whole C++ ecosystem with Cmake compiling to make is a giant headache. It takes about a week to integrate a new C++ library in source code and people are worried about installing or…

It just sounds like you are working on a big messy project.

Nah it's a big unicorn startup down in Irvine, so the codebase is still relatively new. They use C++17 so pretty modern as well.

Re: Does C++ still deserve a bad rap?

#110
post #10

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.
Post reply on HN