Live data from Hacker News

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

stroustrup.com

31–40 of 231 posts

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

#31

Earlier quoted context omitted.

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?

Qt for everything UI-related, yes. SQLite for databases, though looking again that code is actually Python. Nothing networked, so REST isn't relevant.

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

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

Why is that? I'm genuinely curious. Also, what languages / environments do you prefer?

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

#33

Earlier quoted context omitted.

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…

In particular, you don't need volatile unless you're writing hardware device drivers. If you're doing that, then you also need to understand the semantics of the memory mappings of the I/O pages you're writing. You also need to know about bus ordering and request coalescing guarantees for PCIe (or AXI, or whatever your embedded system uses).

If that paragraph doesn't make any sense, and you think you need volatile then there are basically two possibilities: You're writing a Java program (which uses that keyword for something else), or you need std::atomic (or __sync_* for C) instead.

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

#35
post #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.

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

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

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

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

#40

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.

Even Stroustrup falls prey to copy&paste programming.
Post reply on HN