Live data from Hacker News

Does C++ still deserve a bad rap?

nibblestew.blogspot.com

1–10 of 310 posts

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

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

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

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

#5
I don't think C++ ever really had a bad rap except among ideologues and evangelists of other languages. In my experience, people like this are very rare in the real world outside of maybe Rust conferences.

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

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

Why would that be more difficult in C++?

Difficult, probably not.

Verbose and clunky and needs a web search to do, yes.

I'm guessing it's analogous to Java's Regex. Like, yes, they're there and do as much as any other language, but lord it's a PITA.

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

#8
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 example it could be the equivalent of the statement below:

   int x = (foo)2 + (bar)3;
In other words type casting can be written as (foo)2 or as foo(2). Just to make it harder to understand what is going on. As another example consider implicit type conversions:

   Foo b = c + 3;
If 3 is not compatible with whatever type c is then C++ checks if there is a constructor that accepts an int parameter, and it automatically calls the constructor to convert 3 to the appropriate type.

Many of these craziness is being addressed by standards committees. C++ as designed by Stroustrup is a horrible language. Just look at his C++ book. It is huge and heavy and in fact Stroustrup takes pride in how big and complex the language is. C is an awesome language. C++ is horrible.

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

#9
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 management is one of the things that sucks the most in any language, and the ones that dont its because the complexity is hidden in another fundamental layer.

Post reply on HN