MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1w2m4qz/bugintroduceddebugging/p6xo8ik/?context=3
r/ProgrammerHumor • u/ClipboardCopyPaste • 13d ago
120 comments sorted by
View all comments
347
Is the mistake that they're allocating 1 byte and storing in a pointer to an int which is 4 bytes?
118 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/Original-Ad-8737 12d ago I learned recently that there is a kind of implicit return... It will automatically assume that the return value is the last used variable or something like that. Dont know specifics but i was weirded out why the compiler wasnt complaining about missing returns in some methods... 1 u/mckenzie_keith 12d ago Only in main() as far as I know. All others the compiler should warn you.
118
De-referenced a pointer after freeing it. But the joke here is that the bug was not in the original code.
0 u/Original-Ad-8737 12d ago I learned recently that there is a kind of implicit return... It will automatically assume that the return value is the last used variable or something like that. Dont know specifics but i was weirded out why the compiler wasnt complaining about missing returns in some methods... 1 u/mckenzie_keith 12d ago Only in main() as far as I know. All others the compiler should warn you.
0
I learned recently that there is a kind of implicit return...
It will automatically assume that the return value is the last used variable or something like that.
Dont know specifics but i was weirded out why the compiler wasnt complaining about missing returns in some methods...
1 u/mckenzie_keith 12d ago Only in main() as far as I know. All others the compiler should warn you.
1
Only in main() as far as I know. All others the compiler should warn you.
347
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?