Mastering C++ pointers: the pros and cons of (raw) pointers | pointer usage with const

  Рет қаралды 1,667

Code for yourself

Code for yourself

Күн бұрын

Пікірлер: 14
@olegonka8801
@olegonka8801 Жыл бұрын
Крутий контент! Для початківців класне відео
@CodeForYourself
@CodeForYourself Жыл бұрын
Дякую! Сподіваюсь далі підуть відео також для тих "хто вже вміє" 😉
@Anton-vu1ou
@Anton-vu1ou Жыл бұрын
Great video! As always, high quality and quite detailed!
@CodeForYourself
@CodeForYourself Жыл бұрын
Glad you enjoyed it!
@marwanzaghloul6065
@marwanzaghloul6065 Жыл бұрын
Great video, thank you!
@CodeForYourself
@CodeForYourself Жыл бұрын
My pleasure!
@bsdooby
@bsdooby Жыл бұрын
`east const` vs `const west`: the geographic orientation represents the type. E.g., "int \*const ptr" [ptr cannot be reseated], or "int const\* ptr" [ptr cannot change the value it is pointing to]; backslash added to show the star character.
@CodeForYourself
@CodeForYourself Жыл бұрын
Yep, pretty much
@Pedro-jj7gp
@Pedro-jj7gp Ай бұрын
Nice video! Why is the int* 8 bytes instead of 4 at 1:30?
@CodeForYourself
@CodeForYourself Ай бұрын
@@Pedro-jj7gp that’s just the way it usually is on most modern systems: any pointer is 8 bytes. In the end this has to do with being able to address enough places in the memory if this makes any sense. That being said, other systems could theoretically have it be smaller or larger. Does this answer your question?
@Pedro-jj7gp
@Pedro-jj7gp Ай бұрын
@@CodeForYourself It does, but I'm a bit confused as I was watching some other videos about vtables and they showed the vpointer taking up 4 bytes... I guess it could just be on that system.
@CodeForYourself
@CodeForYourself Ай бұрын
@@Pedro-jj7gp it might be. But you can always check it on your system too. I’ve only ever seen 8-byte pointers on every system apart from really non-standard embedded boards. 🤷‍♂️
@Pedro-jj7gp
@Pedro-jj7gp Ай бұрын
@@CodeForYourself Yup, you're right! I just checked using sizeof() both for a regular int* and a vpointer using reinterpret_cast() and both are 8 bytes. The video in question was 12 years old, maybe it was a 32-bit machine
@CodeForYourself
@CodeForYourself Ай бұрын
@@Pedro-jj7gp sounds like a 32 bit system indeed. Glad that it makes sense now 👌
C++ object lifecycle 101: the essentials
9:28
Code for yourself
Рет қаралды 1 М.
SMART POINTERS in C++ (for beginners in 20 minutes)
24:32
CodeBeauty
Рет қаралды 100 М.
Or is Harriet Quinn good? #cosplay#joker #Harriet Quinn
00:20
佐助与鸣人
Рет қаралды 59 МЛН
Re-inventing move semantics in modern C++ in 13 minutes
13:20
Code for yourself
Рет қаралды 6 М.
Smart Pointers in C++ (Stop Using new?)
17:18
Caleb Curry
Рет қаралды 12 М.
C++ Smart Pointers - Do I really need them? When?
28:41
CppMonk
Рет қаралды 9 М.
you will never ask about pointers again after watching this video
8:03
Low Level Learning
Рет қаралды 2,2 МЛН
unique_ptr: C++'s simplest smart pointer
11:54
mCoding
Рет қаралды 43 М.
How principled coders outperform the competition
11:11
Coderized
Рет қаралды 1,7 МЛН
Don't use static (outside of classes) in modern C++
15:56
Code for yourself
Рет қаралды 5 М.
Move Semantics in C++
13:10
The Cherno
Рет қаралды 292 М.
C++ vs Rust: which is faster?
21:15
fasterthanlime
Рет қаралды 395 М.