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