r/ProgrammerHumor 2d ago

Meme bugIntroducedDebugging

Post image
1.1k Upvotes

120 comments sorted by

View all comments

Show parent comments

160

u/atanasius 2d ago

It's allowed to assign to a pointer if it's not dereferenced. Malloc always returns a valid pointer.

51

u/vishal340 2d ago

but accessing it will be issue right?

92

u/SoldRIP 2d ago

that's undefined.

2

u/nullpotato 1d ago

Undefined aka works fine on a dev build but explodes in release because all the debug info the compiler injects aren't there anymore.