Похожие чаты

I often see on the Internet that Steven Prata’s book

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/

13 ответов

40 просмотров

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?

²
Yeah

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.

Pavel
Well, C++ supports many things, one of them is bac...

C++ not have GC, and for this reason have manual memory management same C. Probably your good is not good.

Daniele°
C++ not have GC, and for this reason have manual m...

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)

Pavel
Well, I guess you can technically call RAII manual...

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.

Daniele°
Where you place the object is irrelevant, data, st...

I'm not talking about using heap vs stack, I'm talking about manually allocating/deallocating memory (in the "client"/"user" code)

Pavel
I'm not talking about using heap vs stack, I'm tal...

In any case C/C++ manually allocating the memory. Is irrelevant if caller or called allocate memory.

Daniele°
In any case C/C++ manually allocating the 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.

Похожие вопросы

Обсуждают сегодня

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта