Live data from Hacker News

3rd Edition of Programming: Principles and Practice Using C++ by Stroustrup

stroustrup.com

121–130 of 231 posts

Re: 3rd Edition of Programming: Principles and Practice Using C++ by Stroustrup

#121
post #45

Earlier quoted context omitted.

The most complex, demanding and cutting edge computational fields - Machine Learning, Artificial Intelligence, Real-time multi-user Gaming, High frequency Trading, Rendering/Animation, High Performance Computing, Compiler infrastructure (LLVM) - are all at the core written in C++ for the most part. There is no other option in the foreseeable future as the investment needed to rewrite (if you can find the people) is i…

> So you will need to know C++ if we want to be the cutting edge and need extreme performance. I would suggest a better phrasing might be that you should learn C++ if you want to cling to existing software in the state it is today, certain that history ended yesterday and the future is just the same forever from here on. You won't get "extreme performance" from C++ because it is buried under the weight of decades of…

I don't even know what you are trying to say here. C++ is great to program in and has a fantastic eco system of tools and libraries. It is something you can safely base a business around.

You won't get "extreme performance" from C++ because it is buried under the weight of decades of compatibility hacks.

This doesn't even make sense. What is an example of something that can't be fast because it is done in C++? What "compatibility hacks" are slowing programs down?

This does not sound like something someone with experience in C++ would say.

Re: 3rd Edition of Programming: Principles and Practice Using C++ by Stroustrup

#122

Huh. The ISBN shown at the top of the page (currently "9780136816485") appears to be incorrect. That seems to be the ISBN for "A Tour of C++" from 2022. The ISBN for this book is, according to the Amazon product page[1], "9780138308681". [1]: https://www.amazon.com/Programming-Principles-Practice-Using... Edit: emailed Mr. Stroustrup and he just replied to say that the bad ISBN has been corrected.

Darn, I don’t think Bjarne sends $2.56 checks.

I think you just earned yourself a coveted check for `sizeof(attaboy)`, and I’m jealous.

Re: 3rd Edition of Programming: Principles and Practice Using C++ by Stroustrup

#123
post #122

Huh. The ISBN shown at the top of the page (currently "9780136816485") appears to be incorrect. That seems to be the ISBN for "A Tour of C++" from 2022. The ISBN for this book is, according to the Amazon product page[1], "9780138308681". [1]: https://www.amazon.com/Programming-Principles-Practice-Using... Edit: emailed Mr. Stroustrup and he just replied to say that the bad ISBN has been corrected.

Darn, I don’t think Bjarne sends $2.56 checks. I think you just earned yourself a coveted check for `sizeof(attaboy)`, and I’m jealous.

Just being able to say that I got a response from Bjarne Stroustrup is reward enough in its own right!

Re: 3rd Edition of Programming: Principles and Practice Using C++ by Stroustrup

#124
post #34

Sorry if it is a bit off-topic. If you just started learning C++, why did you choose it instead of another language? (Rust, C#, Go, etc) I know a bit of C but feel that the sheer "thickness" of C++ is too daunting and scary to even start.

There are still some high-performance software domains where (modern) C++ is unambiguously the best tool for the job. Database engines are a good example of this, they pervasively break the compiler's understanding of object lifetimes which requires flexibility in the language that C++ can explicitly express in an ergonomic way.

No one learns all of C++, you just need to learn the bits that are useful for the kinds of applications you write. If, for example, you are building database kernels then you are unlikely to use any of the STL containers (even std::array and std::vector are infrequent) in most of the code. However, you will need to know how to manually fix-up object lifetimes using semi-obscure language features you would never need to know about for most server apps.

If you stay within a relatively narrow application domain, the useful parts of C++ for that domain crystallize pretty readily in my experience, which is much easier to learn.

Re: 3rd Edition of Programming: Principles and Practice Using C++ by Stroustrup

#125

Know what I like about Stroustrup's code? "using namespace std;". The typical convention of sticking std:: in front of std::every std::last std::bloody std::thing drives me std::insane.

I hear that once c++ modules lands this shouldn't be controversial anymore, right?

Re: 3rd Edition of Programming: Principles and Practice Using C++ by Stroustrup

#126

Earlier quoted context omitted.

Yes, roughly so. 1) The major part of C to avoid is raw pointers and malloc, and generally anything where C++ has a more modern alternative. Don't use C datastructures (pointers, strings, arrays) where C++ replacements exist (smart pointers, std:string, std::array and std::vector, etc), or use C libraries where C++ replacements exist (e.g. C++ std::string vs C's string.h). Of course you can't avoid all of C, since th…

Although Microsoft refers to their implementation of the standard library as the STL (and this is convenient naming, since one of its most important maintainers is STL, Stephan T. Lavavej) actually the STL and the C++ standard library aren't the same thing. The Standard Template Library is Alexander Stepanov's generic programming achieved via the relatively new (at the time) C++ Templates feature. At this point (the…

Sure, but that's really more of a historical perspective. The STL is still there as part of the standard library, although basically just the containers portion. It's been so long since I used the original standalone (SGI) version of the STL, that I can't even recall exactly what was in it other than containers and iterators (any algorithms?).

Re: 3rd Edition of Programming: Principles and Practice Using C++ by Stroustrup

#127
post #25

Earlier quoted context omitted.

I personally recommend starting with Stroustrup’s other book…A Tour of C++. It really brings you up to speed quickly with what you need to know in the language without a lot of excess fluff. It’s also very up to date compared to other books.

I love that format, more languages should do it. One of the few pure language books I read cover to cover.

I agree!

Another approach I really like are interactive “notebook” style language tutorials. Swift Playgrounds is an excellent implementation of this.

Re: 3rd Edition of Programming: Principles and Practice Using C++ by Stroustrup

#128
post #42

Earlier quoted context omitted.

These days, OO programing is mostly frowned upon. OO added the idea of implementation inheritance to interfaces, and that's mostly a bad idea. Newer languages and modern C++ favor composition instead. You define interfaces that provide some well-defined capability, and then you write things that wrap the interfaces to provide additional functionality. In C++ you can use templates to do this without any runtime overhe…

https://www.tiobe.com/tiobe-index/ Without having to squint, 12 of those languages are easily categorized as OO languages. Given the mindshare of those 12 languages, I don't think it makes sense to say that "OO programming is mostly frowned upon." [emphasis added] Maybe it's frowned upon by some, maybe even many, but if it's mostly frowned upon then a lot of people must hate their work.

They are, if I'm understanding correctly, referring to what may be considered the 'traditional' OOP style (Animal, which has various properties and behaviours, is extended by Dog, which has its own properties and behaviours, maybe overriding those of Animal) vs a style where inheritance is use primarily to define and implement interfaces (i.e., an expected set of behaviours with no implementation included in the base class). In other words, the different ways a language supporting OOP may be used rather than what the language supports in and of itself.

Re: 3rd Edition of Programming: Principles and Practice Using C++ by Stroustrup

#129
post #17

I miss my days working with C++. It's moved further down the development stack than where it used to be. We used to handle UI, API parsing, and pretty much everything using C++.

I felt some nostalgia for Fortran a while ago. Spent half an hour programming in it, cured. Maybe take a shot at parsing JSON in C++ and see if the nostalgia survives the process.

Let me carefully copy paste my personal stringutils.hpp file of string handling routines and I'll be right up to it!

Re: 3rd Edition of Programming: Principles and Practice Using C++ by Stroustrup

#130
post #122

Earlier quoted context omitted.

Darn, I don’t think Bjarne sends $2.56 checks. I think you just earned yourself a coveted check for `sizeof(attaboy)`, and I’m jealous.

Just being able to say that I got a response from Bjarne Stroustrup is reward enough in its own right!

Actually he does respond to emails and he is responsive to constructive feedback from my experience.
Post reply on HN