Live data from Hacker News

C++: Is It Really a Cruel Joke? (2003)

webhome.phy.duke.edu

71–80 of 155 posts

Re: C++: Is It Really a Cruel Joke? (2003)

#72
post #63

Earlier quoted context omitted.

I wonder how things have progressed from a security/stability standpoint - my OS definitely crashes a lot less, I'm guessing because there is less C in it now...

Which OS? Linux and Darwin are still entirely C in the kernel, I believe. Windows is C++.

It seems that windows kernel is C also : https://www.reddit.com/r/cpp/comments/4oruo1/windows_10_code...

Re: C++: Is It Really a Cruel Joke? (2003)

#73

Dr. Stroustrup took a lot of pain to ensure the language was useful and did not break backward compatibility. He also always maintained that if you don't use a feature you shouldn't pay for it (in terms of performance). Eventually, it became even more popular and there is now a whole organisation behind the international standards for the language. The book "The Design and Evolution of C++" helps one understand why s…

I am not a C++ fan. But D&E of C++ is one the best books I ever read. It explains a lot of the real world of the decisions they had to make. It was iluminating.

Re: C++: Is It Really a Cruel Joke? (2003)

#74
post #69
post #37

Why do we as developers feel a need to constantly trash the things we don't like? If you don't like something, don't use it. Talk about the things you do like instead.

While I agree that it is good to not always dwell on the negative, there can be a lot of value in pointing out the deficiencies of programming languages. Some folks will just use a language without thinking about its downsides. If you use language X for a long period of time, you can become blind to areas where it is wasting your time. Again, I do agree that the tone could often be much more civil, but I would hate f…

I wasn't saying there's no place for constructive criticism or critiques. Those are definitely useful and important.

But that's not what this article is, and I think we all know the tendency I'm talking about for people to spend more energy and feel more comfortable trashing things than talking about what they like.

Re: C++: Is It Really a Cruel Joke? (2003)

#75
post #45

I know C++ isn't really dying off, but what is the best platform-agnostic compiled object-orientated language these days? I liked Borland Pascal, and I know Delphi is kind of ticking along, but I'd rather invest in a language that is growing. Swift looks nice but still seems too Apple focused. Don't want to start a war, just open to some tips on the ecosystem..

If you liked Borland Pascal/Delphi then check out Free Pascal/Lazarus. If nothing else, it is growing (a bit too much if you ask me, but it isn't the monster that C++ is - yet). The main star of the show here is Lazarus which is basically a cross platform Delphi with support for the native widgets for each platform (on Linux you can choose between Gtk+ and Qt).

Another alternative is D, which is basically C++ minus a few warts, the option to have a somewhat faster compiler (all modern C++ compilers are very slow) but it wasn't made yesterday so it has accumulated its own cruft (most common being that most of the new "flags" for declarations being in the form of "@stuff" instead of just "stuff" even though some older stuff being just "stuff" so things look a bit messy - in a similar vein, the new supposedly best practice, especially for libraries, is for functions to be pure and nogc, but this isn't the default so you have to put the declarations everywhere). Still, it is the most obvious choice for someone who wants a better language than C++ without changing too much.

There is also Rust, but i don't know about it.

Re: C++: Is It Really a Cruel Joke? (2003)

#76

"There are only two kinds of languages: the ones people complain about and the ones nobody uses." -- Bjarne Stroustrup [1] [1] http://www.stroustrup.com/bs_faq.html#really-say-that

There are plenty of languages in use that people genuinely enjoy using [1]. A lot of complexity in languages tends to be completely incidental. It's often not inherent in the problem the language solves, and it's just a design decision somebody made based on their aesthetic and experience at the time.

A lot of people seem to take pride in memorizing these quirks, but they're just that. There's nothing fundamentally interesting about them, and they're just mental clutter at the end of the day.

We should strive to have well designed languages that are optimized for developer experience. Accepting poor design decisions just keeps perpetuating the problem.

[1] https://insights.stackoverflow.com/survey/2018/#most-loved-d...

Re: C++: Is It Really a Cruel Joke? (2003)

#77
post #30

Dr. Stroustrup took a lot of pain to ensure the language was useful and did not break backward compatibility. He also always maintained that if you don't use a feature you shouldn't pay for it (in terms of performance). Eventually, it became even more popular and there is now a whole organisation behind the international standards for the language. The book "The Design and Evolution of C++" helps one understand why s…

I read that book around 1998 and was an instant convert. C++ has a steep learning curve, and does not stop you from getting yourself into a lot of trouble, but it does stand up to Bjarne’s original promise about performance. IMHO the STL is one of mankind’s greatest accomplishments.

STL tried hard to abstract pointer manipulation semantic of low-level C and apply it everywhere whether it fit or not. This pointer heritage inevitably lead to misfeatures like invalidation of iterators under container mutations or the need to have access both to the iterator and its container to implement things like vector::erase().

Other languages and runtimes use the notion of an iterator or cursor that is alone enough to perform all looping-like operations on the container including efficient erase() and can cheaply (so it is ok to have that in production) or even with good optimizing compiler at zero cost provide protection against container mutations.

Re: C++: Is It Really a Cruel Joke? (2003)

#78
post #45

I know C++ isn't really dying off, but what is the best platform-agnostic compiled object-orientated language these days? I liked Borland Pascal, and I know Delphi is kind of ticking along, but I'd rather invest in a language that is growing. Swift looks nice but still seems too Apple focused. Don't want to start a war, just open to some tips on the ecosystem..

I'm pretty fond of D and Nim.

Re: C++: Is It Really a Cruel Joke? (2003)

#79
post #50

Having spent the past decade working with python, I've always considered C to be a mystical black box for hardcore systems guys. I recently needed to write some high performance networking code so I decided to give it a shot. At first I found it painfully verbose and confusing, with the simplest operations requiring lines of code. After a couple days I found it to be rather refreshing, it encourages you to look at me…

I stumbled into Nim recently and this thing "just works". Python-like syntax, performance like C. This is what C should have been, I'd say. https://nim-lang.org/

I would encourage you to use Cython instead of Nim if you're looking for Python-like syntax combined with C performance.

Re: C++: Is It Really a Cruel Joke? (2003)

#80

Earlier quoted context omitted.

I always felt that if you wanted the same functionality as c++ in terms of performance, flexibility and power of abstraction, you'd end up with something as complex as c++. Modern c++ shows there was/is room for improvement, but it does not fundamentally simplify the language imo.

Only if it need to have backward compatibility. Rust doesn’t so it can be vastly simpler.

How is Rust simpler than C++?
Post reply on HN