C++ Primer Plus is a bad book for learning, tell me, is this true?
links with negative information about the book
https://www.reddit.com/r/cpp/comments/13g6s1/which_c_primer_book_is_better/
https://cplusplus.com/forum/lounge/127667/
https://cplusplus.com/forum/beginner/106097/
I haven't read it, but the reasoning (teaching obsolete ways to write code) is strong enough to avoid it
what do you mean?
By "obsolete ways" you mean?
Well, C++ supports many things, one of them is backward compatibility with C. It used to be a common way to teach C++ is first to teach C and then teach C++. But the problem with it is that with modern C++ (C++11 and above) the patterns in how people write code changed, and a lot of C ways of doing things are to be avoided now. One big example is manual memory management which is the heart of C and when people teach C++ manual memory management is taught to be avoided unless it is absolutely needed. One can even say that a lot of good C code is bad C++ code.
C++ not have GC, and for this reason have manual memory management same C. Probably your good is not good.
meme:"yours RAII its just GC but better"
C have little raii
Well, I guess you can technically call RAII manual memory management too, if you oppose GC to everything else. But what I mean is that you don't normally do new/delete and malloc/free in modern C++, it is considered code smell to have that in the code unless it is very well contained. We're not talking about codebases that were written long ago (or codebases that have their own GC)
Where you place the object is irrelevant, data, stack, heap. The only reason not to use the heap is if you follow MISRA, but the reasons are different.
I'm not talking about using heap vs stack, I'm talking about manually allocating/deallocating memory (in the "client"/"user" code)
In any case C/C++ manually allocating the memory. Is irrelevant if caller or called allocate memory.
It is irrelevant only if you look at it from a technical perspective, but as soon as it comes to writing code that is easy to maintain, you come to not expose any of that to the user of your library, and hiding all lower level memory related operations you can behind solid raii classes/objects/interfaces/abstractions/... you name it.
Обсуждают сегодня