Loading video...
Video Failed to Load
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

this is what matters

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

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

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

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.

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

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

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.

hmm interesting.

2026 bro no one cares anymore

void pointers, the real polymorphism

Boy, you don’t want my ass multiplying.

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

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

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