Live data from Hacker News

Does C++ still deserve a bad rap?

nibblestew.blogspot.com

71–80 of 310 posts

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

#71

I'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…

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++?

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

#72
> This code compiles, runs and works [1] on all major platforms using only the default toolchain provided by the OS vendor without any external dependencies or downloads. This is something that no other programming language can provide as of date.

Isn't that provided by at least Golang and Zig currently?

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

#73
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...

To be fair this is not a problem of the language but a library problem.

I'm not sure whom/what this is being fair to, given both of these are specified by the C++ standard, but sure.

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

#74

I'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…

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++?

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

#75

C++ is a very poorly designed language. A lot of the work being done by the committees is fixing Stroustrup's mistakes. Consider horrors such as this. In the following statement what are foo and bar? int x = foo(2) + bar(3); Most people will say foo and bar are functions and that's a reasonable guess. Unless you are talking about C++. In C++ foo and bar could be functions but could also lots of other things. For exam…

Well, constructors are not very different from functions, from the caller point of view. Also, Python is much worse in this: any call can be monkey patched at basically any point during the execution, but people do not (usually) use this as an example of poor language designing. You expect the programmer to use the language features considerately.

BTW, in C++ every call is resolved at compile time, and the compiler could tell you what you are exactly doing at each line, including whether your examples are function calls or casts. If you dump the right table in GCC the information is there, although it's a pity there is no convenient way to access it. Cppexplorer helps a little bit, but I always find it difficult to understand. It's a problem of tooling, though, the language is well defined.

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

#76

Like 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.

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

#77

Earlier 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++?

Your system package manager, usually, along with something to detect/configure dependencies (autotools, CMake, etc). CMake can be set up to automatically download missing dependencies in some cases, too, and I think there are some other build systems that provide this sort of functionality. But there's not some standard packaging system a la pip or cargo or the like.

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

#78
post #4

Earlier quoted context omitted.

Why would that be more difficult in C++?

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

Beh, it's one function call if you use Qt or boost

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

#79

C++ is, quite rightly, considered an overly-complex and bloated language. A lot of newer features are papering over poor design from the beginnings of the language. But.. There is something about the use of destructors, RAII, and even smart-pointers that just feels so...elegant? I'm not sure what the word is I'm looking for. I feel like there's a kernel of a beautiful language hiding in c++ and those features are the…

Because C++ has almost all the possible features of the programming languages, so you find a subset to like in it. A language shines when it picks the correct subset of the features, not all.

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

#80

Earlier 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++?

> Is there some sort of standard / commonly accepted way to manage packages for c++?

As others have pointed out, CMake is the de facto standard in C++. However, a combination of CMake with Conan seems to take care of most of anyone's needs. The downside is that the availability of C++ packages in Conan tends to be very limited.

Post reply on HN