Bjarne Stroustrup
Does C++ still deserve a bad rap?
31–40 of 310 posts
Re: Does C++ still deserve a bad rap?
#32I 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.
I guess my point is, this is a weird (and IMO, flat-out wrong) dig at the Rust community.
Re: Does C++ still deserve a bad rap?
#3360 lines of "portable code" turns out not to be portable.
Practically every line requires some piece of C++ ceremony.
The nightmares around the potential for "undefined behavior" and miscompilations of code by C++ are ignored.
It has always been the case that there are several subsets of C++ which make reasonable languages. The problem is that when you combine them in the wrong way, you get into a world of hurt. And in the real world, C++ programmers do not agree on which subset to use.
Re: Does C++ still deserve a bad rap?
#34Re: Does C++ still deserve a bad rap?
#35Earlier quoted context omitted.
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…
I think it's pretty nice in Scala. I don't know if "no virtual machines" was implied as part of the "no script languages" request, though. scala> "Mary had a little lamb. The lamb was in federal witness protection.".split("lamb") res0: Array[String] = Array("Mary had a little ", ". The ", " was in federal witness protection.")
I meant for languages where the hard parts are delegated to another like Python and Javascript (C and C++ respectively).
Re: Does C++ still deserve a bad rap?
#36Re: Does C++ still deserve a bad rap?
#37Like 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…
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 it hard to leave Python.
Re: Does C++ still deserve a bad rap?
#38I 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++?
There is, however, boost::split from the famous boost library.
Re: Does C++ still deserve a bad rap?
#39Depends: does it still have header files?
for people that dont like headers, how do you browse the api of a class? Scrolling through the implementation?
i like how haskell does it: https://hackage.haskell.org/package/base-4.14.0.0/docs/Data-...
Re: Does C++ still deserve a bad rap?
#40C++ 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…
The casting style can be enforced via linting. There are also C++ cast operators, that in my opinion should be preferred to the C style casts: static_cast, dynamic_cast, reinterpret_cast, const_cast, static_pointer, dynamic_pointer_cast, const_pointer_cast... and you can enforce that those are preferred rather than C style casts.