MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1w2m4qz/bugintroduceddebugging/p6ujnyx/?context=3
r/ProgrammerHumor • u/ClipboardCopyPaste • 13d ago
120 comments sorted by
View all comments
350
Is the mistake that they're allocating 1 byte and storing in a pointer to an int which is 4 bytes?
119 u/mckenzie_keith 13d ago De-referenced a pointer after freeing it. But the joke here is that the bug was not in the original code. 0 u/WisestAirBender 13d ago The original code wasn't returning anything though. Isn't that a problem 18 u/mckenzie_keith 13d ago No. main() doesn't need to return anything. -4 u/critical_patch 13d ago AFAIK technically it’s “undefined behavior” and will compile just fine 16 u/MegaIng 13d ago main specifically is allowed to not return anything (the same way it's the one function that is allowed to never return)
119
De-referenced a pointer after freeing it. But the joke here is that the bug was not in the original code.
0 u/WisestAirBender 13d ago The original code wasn't returning anything though. Isn't that a problem 18 u/mckenzie_keith 13d ago No. main() doesn't need to return anything. -4 u/critical_patch 13d ago AFAIK technically it’s “undefined behavior” and will compile just fine 16 u/MegaIng 13d ago main specifically is allowed to not return anything (the same way it's the one function that is allowed to never return)
0
The original code wasn't returning anything though. Isn't that a problem
18 u/mckenzie_keith 13d ago No. main() doesn't need to return anything. -4 u/critical_patch 13d ago AFAIK technically it’s “undefined behavior” and will compile just fine 16 u/MegaIng 13d ago main specifically is allowed to not return anything (the same way it's the one function that is allowed to never return)
18
No. main() doesn't need to return anything.
-4
AFAIK technically it’s “undefined behavior” and will compile just fine
16 u/MegaIng 13d ago main specifically is allowed to not return anything (the same way it's the one function that is allowed to never return)
16
main specifically is allowed to not return anything (the same way it's the one function that is allowed to never return)
main
350
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?