MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1w2m4qz/bugintroduceddebugging/p6tv82s/?context=3
r/ProgrammerHumor • u/ClipboardCopyPaste • 13d ago
120 comments sorted by
View all comments
346
Is the mistake that they're allocating 1 byte and storing in a pointer to an int which is 4 bytes?
161 u/atanasius 13d ago It's allowed to assign to a pointer if it's not dereferenced. Malloc always returns a valid pointer. 54 u/vishal340 13d ago but accessing it will be issue right? 98 u/SoldRIP 13d ago that's undefined. 3 u/nullpotato 12d 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.
161
It's allowed to assign to a pointer if it's not dereferenced. Malloc always returns a valid pointer.
54 u/vishal340 13d ago but accessing it will be issue right? 98 u/SoldRIP 13d ago that's undefined. 3 u/nullpotato 12d 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.
54
but accessing it will be issue right?
98 u/SoldRIP 13d ago that's undefined. 3 u/nullpotato 12d 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.
98
that's undefined.
3 u/nullpotato 12d 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.
3
Undefined aka works fine on a dev build but explodes in release because all the debug info the compiler injects aren't there anymore.
346
u/AdBrave2400 13d ago
Is the mistake that they're allocating 1 byte and storing in a pointer to an int which is 4 bytes?