Live data from Hacker News

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

stroustrup.com

21–30 of 231 posts

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

#22
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++.

Same. I really miss it. Not terribly long ago we had an app that has a client and server, both in c++. UI, API, everything was c++. It really felt like the universal language had arrived. I won't pretend everything was perfect as it wasn't, but work was fun and the high caliber of people who could work in that stack was a joy to work with. I've never had a more exciting lunch than when we got distcc running on our blades so we could execute builds way faster. It was also a joy not being the only Linux zealot :-D

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

#23

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.

Already teaching you about the maintainability of tightly coupling different parts of your system before you've even opened the book

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

#24
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++.

Where I am, we still do!

What libraries are you using? Qt? Do you use anything for database access and rest API (or protobufs like we did) or just custom code?

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

#25

I've always wanted to learn C++. I have a great handle on C#, making large applications and architectures as well as legacy refactoring in C#, and I would love to learn C++. I recently started at a company with a bit of a hairy c++ application that I would love to refactor or understand more thoroughly. Is this book a good place. Note that I have read a very basic book on C++ much more learning programming book, but…

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.

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

#26

I've always wanted to learn C++. I have a great handle on C#, making large applications and architectures as well as legacy refactoring in C#, and I would love to learn C++. I recently started at a company with a bit of a hairy c++ application that I would love to refactor or understand more thoroughly. Is this book a good place. Note that I have read a very basic book on C++ much more learning programming book, but…

Scott Meyers’ “Effective C++” series are digestible reads that cover the corner cases a modern C++ developer might hit, as well as guidelines and best practices to keep from shooting yourself in the foot.

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

#27
post #2

Sharing the C++ Annotations here, which is a continiously updated book on modern C++. http://www.icce.rug.nl/documents/cplusplus/

If I just use C with classes, plus smart pointers and auto, for my emulator project(s), would that be a reasonably good approach? I once heard that the C++ language contains 4 components: the first catalog is "C", the second is for OOP, the third is for productivity and flexibility such as stl and templates, and the last one is for special cases such as volatile, asm, etc. He then recommends to use catalog 1 with car…

I started off writing C++ this way, basically writing it like it was C89.

This is fine if you do not plan to share your work with others, but it's not well-written C++. It will bite you later on. It's best to learn the C++ way of doing things. It will save you so much time and headache. Don't use character arrays, use strings. Don't use C arrays, use std::vector or std::array. Don't write your own lists or sets, use std::list/set or std::unordered_list/set. Don't use strcat when std::string operator + exists. Etc.

I personally rarely use smart pointers or make_shared/make_unique these days. I just don't need pointers. Most of the time allocation can be done without them, and when I need to pass things around I use references. There are exceptions for C APIs for cross-platform/cross-compiler work, of course. And sometimes library code needs it, ofc.

The STL and are your friend. They solve so many problems in a very elegant way. Learning them should be a priority.

I'd go easy on the OOP elements unless you know OOP programming very well. Just using classes as containers for data and functions is more than fine for C++ most of the time.

Writing your own templates can be a bit of a footgun until you understand them. Feel free to put that off awhile.

Don't mess with volatile and asm unless you are 100% sure that what you're doing needs it.

Also: Be cautious with use of auto. A bit here and there is fine, but too much and code can become unreadable. C++ is a typed language for a reason.

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

#28
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 just wish to _not_ work with Python.

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

#29

Earlier quoted context omitted.

Link works for me (firefox 125), but only if I use http (port 80), port 443 get me 404 not found as well.

Ah, you're right. The issue is the link switching from http to https (even though the supplied link is http) and Chrome making it difficult (by default) to see whether http or https is being used. If I just copy/paste the link it works fine in Chrome and Edge but clicking on the link they both switch it to https. Brilliant. Just tested, works fine with Safari (mobile, but desktop usually has the same behavior).

The webserver setup seems sloppy. If the site is http only, have https redirect to port 80 or remove the vhost altogether. Not great for an educational institution doing serious computer science.

Chrome's attempt to use a secure connection resulting in 404 while the actual link works fine isn't great. But it's understandable and the TLS-first assumption the're using probably works just fine in the other 99.999% situations.

If only they'd taken the time to copy the http config and setup let's encrypt or cert from GEANT Vereniging CA apparently preferred by rug.nl...

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

#30
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++.

At my work pretty much everything but the UI is in C++. I suspect the only reason the UI isn't C++ is so we have a portion of the cosebase that recent grads can work on right away without having to train them up in C++.
Post reply on HN