Loading video...

Video Failed to Load

Go Home

You cannot add to a void pointer in C. The compiler does not know the size. The everyday fix is to cast it to char* so the math is in bytes, then multiply by the element size yourself. Stanford CS107, lecture 4

28,004 views • 2 months ago •via X (Twitter)

15 Comments

acidburn's profile picture
acidburn2 months ago

this is what matters

Jack's profile picture
Jack2 months ago

You shouldn’t be using void pointers in the first place.

Ray Epps's profile picture
Ray Epps2 months ago

there was a time when i was addicted to the stanford and harvard cs class recordings

JETLAB-X's profile picture
JETLAB-X2 months ago

Good Lord… flashback nightmares… I despised Object C/C++ glad XCode lets me do stuff with Swift.

BullBear.News's profile picture
BullBear.News2 months ago

Nothing like realizing at 2 AM that your pointer arithmetic on a void star just silently broke on ARM because the ABI handles things differently.

Adrien Chauvet's profile picture
Adrien Chauvet2 months ago

Thank God, with AI it's becoming increasingly possible to create software without having to struggle with such hieroglyphs.

symbols's profile picture
symbols2 months ago

I am self taught and felt like an imposter for all the 15years until I watched this lecture, then I saw my true mind.

Chris Ziomkowski's profile picture
Chris Ziomkowski2 months ago

I worked on a custom architecture that didn't have byte addressing, so char* was the same as int*. Assuming char* is only 1 byte wide is a very bad idea. You should cast void* to uint64_t and do your work as integers if you want it to be portable.

Deepak's profile picture
Deepak2 months ago

hmm interesting.

Gustavo Rocambóli's profile picture
Gustavo Rocambóli2 months ago

2026 bro no one cares anymore

音GATO's profile picture
音GATO2 months ago

void pointers, the real polymorphism

ᴅ ᴇ ᴀ ᴅ ʙ ᴏ ʏ's profile picture
ᴅ ᴇ ᴀ ᴅ ʙ ᴏ ʏ2 months ago

Boy, you don’t want my ass multiplying.

Mēgan DeMarco's profile picture
Mēgan DeMarco2 months ago

No comprehend lol I actually don't know what you mean by this one explain please

Pitchfork & Torch ♞'s profile picture
Pitchfork & Torch ♞2 months ago

void* can’t count. We measure in chars!

Clank's profile picture
Clank2 months ago

Wow even more basic shit information will it ever stop thank you

Related Videos

CSS Trick! 🤙 You can create gradient borders on translucent elements using mask-clip and mask-composite with a pseudo-element 🔥 .gradient-border::after { mask-clip: padding-box, border-box; mask-composite: intersect; mask: linear-gradient(transparent, transparent), linear-gradient(white, white); } It's the same "Transparent border trick" from before. But, now you apply it to a pseudo-element 😎 The trick is to create a pseudo-element with a gradient background and then mask it so we only see the part we want, the border ✨ mask-clip defines the area affected by a mask. Similar to how you can define background-size. Using padding-box and border-box constrains the two masks. mask-composite is the magic part ✨ It defines a compositing operation for stacked mask layers. Using intersect means that the parts that overlap get replaced. And this seems to work in all browsers 🙌 As for the rest of the styles... – Make sure you set pointer-events: none on the pseudo-element – Make sure it fills the parent element. You can use position: absolute and inset: 0 – Make sure the background fills the space including the border-width. You can use calc to achieve that: --bg-size: calc(100% + (2px * var(--border))); background: var(--gradient) center center / var(--bg-size) var(--bg-size); That's it! 🚀 Gradient borders on translucent elements. You can set all the backdrop-filter: blur() you like! 😅 CodePen.IO link below! 👇

jhey ʕ•ᴥ•ʔ

269,966 views • 3 years ago