320
the "good" parts (lemmy.world)
submitted 2 weeks ago by [email protected] to c/[email protected]
top 20 comments
sorted by: hot top new old
[-] [email protected] 52 points 2 weeks ago

C++ the good parts exclusively uses on stack allocation and passing by const reference without ever introducing pointers.

You know this to be true.

[-] [email protected] 39 points 2 weeks ago

Pointers is a pathway to memory that some consider to be… unnatural

[-] Dudewitbow 15 points 2 weeks ago

Because its essential for application use where memory management becomes extremely vital, usually due to the rom or memory to be extremely linited in size. Worrying about memory management (something C++ makes mandatory) is something not all programmers need to care about, but having automated memory mangement is also what causes bloat that comes with modern applications, due to bad programming practices of not caring about it.

[-] [email protected] 11 points 2 weeks ago

Only Garbage Collectors deal in absolutes

[-] [email protected] 1 points 2 weeks ago

Is it mandatory in C++? I don't do much with C++ regularly, but I was under the impression that destructors made it so that you wouldn't have to manually release memory each time an object was destroyed. Or do you mean specifically regarding pointers to those objects needing to be released as well?

[-] Dudewitbow 2 points 2 weeks ago* (last edited 2 weeks ago)

When you ever call new/malloc, its mandatory(dynamic allocation). For general programming, the size is usually decided at compilation.

Yes destructors will unallocate the memory, but the process of writing the destructor is part of the task of memory management

It becomes madness if you attempt to call dynamic memory outside of a class and its destructor, and hopefully the dev actually remembers to release said memory when their done.

[-] [email protected] 12 points 2 weeks ago

I tried to get that reference, but MemoryAccessOutOfBounds.

[-] [email protected] 6 points 2 weeks ago
[-] [email protected] 13 points 2 weeks ago

This is basically C++ in the embedded world, and yes it's the only good C++

[-] [email protected] 2 points 2 weeks ago

Also Qt basically forces you into this mode... and yea, it is a better way.

[-] [email protected] 4 points 2 weeks ago

Only integral unsigned numbers, no reference taking at all, no side-effect operators...

[-] [email protected] 37 points 2 weeks ago

It sounds like a lie to me. Everyone knows there are no good parts of JavaScript.

[-] [email protected] 2 points 2 weeks ago

It has some good parts, such as the ability to use for loops, and the fact you can kind of avoid using it as much thanks to it's webassembly support

[-] [email protected] 19 points 2 weeks ago

The problem is everyone disagrees on what part of C++ is good... Some like C+classes. Some like intense meta programming and some like functional programming and all are valid C++ that people advocate for.

[-] [email protected] 17 points 2 weeks ago

The only thing you need to know is goto statements

[-] [email protected] 4 points 2 weeks ago

Switch up the paradigm… in case you forgot to break out it

load more comments (1 replies)
[-] [email protected] 13 points 2 weeks ago

that's still too thick a book for the good parts of javascript

[-] [email protected] 8 points 2 weeks ago

This is for any subject.

There's a LOT of things that you don't need to know. Take for example, cooking. To get good, you don't need to know how fancy tricks. You just need to know the basics very well.

But after being experienced, it's valuable to know the other 95%. Those weird edge cases.

[-] [email protected] 7 points 2 weeks ago

There's a difference: in this case it's not about omitting fancy tricks you don't need to know until you become an expert; it's about omitting ill-considered features that should never have existed to begin with (or, at best, features that made sense at some point in the past but don't anymore) and that nobody should ever use again no matter how expert they get.

this post was submitted on 21 Nov 2023
320 points (94.9% liked)

Programmer Humor

166 readers
68 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 4 years ago
MODERATORS