Похожие чаты

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 ответов

8 просмотров

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.

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

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

Может кто встречал такое? Один набор данных, но в одном столбце кодировка нормальная, а в другом ироглифы. Как такое может быть?
Alexander
23
Yooo, Guys! 🤩 Did you see the latest FunToken stats? We're on fire! 🔥
SpaceGemz
33
@Qloud777 When this 480,000 tps take part in kadena? When we will achieve it?
Zen Stark
23
https://x.com/RyanMattaMedia/status/1776933030075961360?t=MIVkj90yB79nbhZT6FeOBA&s=09 How do you answer to this? This is talking a lot in X. I also see lots of inflows to exc...
Umut
6
For managing user-generated content rights in gaming? 🤯🚀
Brian
37
Do you think SOL will continue to rise?
Caroline
25
Shouldn't the finish guys with their embassies also give you some support if kidnapped in Bangladesh?
Noir
19
Всем привет. Подскажите, пожалуйста, почему не ищет русскую букву а? А английскую ищет. Полагаю что-то с кодировкой. Но как исправить это? procedure TfrmMain.btnOpenFileClic...
Евгений
7
коллеги, добрый вечер! А никто не знает как модальная форма может себя закрыть? Ну допустим модальная форма определила, что смысла ей работать нет и хочет вернуть modalResult...
Михаил
83
И к какой архитектуре привязана Java?
Dmitry Olshansky
17
Карта сайта