MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programminghumor/comments/1riy8yk/cursor_would_neverrr/o89a2hn/
r/programminghumor • u/[deleted] • Mar 02 '26 • 1
155 comments sorted by
View all comments
238
return recalculate()
the comment stated that it had to be recalculated twice
52 u/coderman64 Mar 02 '26 But it...it won't be... 21 u/TwinkiesSucker Mar 02 '26 The times code design is about what it actually does instead of what we think it does are long gone 4 u/Elia_31 Mar 03 '26 If it's doing something with global variables? 13 u/coderman64 Mar 03 '26 No, the first return exits the function entirely, so the second will never be executed.It's a basic mistake that most linters will warn you about. 2 u/FloydATC Mar 04 '26 Pff, just redefine "return". Easy.There may be side-effects. 7 u/Ashamed_Band_1779 Mar 02 '26 How is this not a compile error? 18 u/Stolberger Mar 02 '26 Usually it is just flagged as a warning "unreachable code", but might depend on the language and/or compiler and/or IDE 3 u/Gsusruls Mar 03 '26 And/or ci linting tool 3 u/TaiyouShinNoIbuki Mar 03 '26 Bravo future tech lead 2 u/-FTOH- Mar 06 '26 Sometimes it even may work...function example() { try { return recalculate() } finally { return recalculate() } }
52
But it...it won't be...
21 u/TwinkiesSucker Mar 02 '26 The times code design is about what it actually does instead of what we think it does are long gone 4 u/Elia_31 Mar 03 '26 If it's doing something with global variables? 13 u/coderman64 Mar 03 '26 No, the first return exits the function entirely, so the second will never be executed.It's a basic mistake that most linters will warn you about. 2 u/FloydATC Mar 04 '26 Pff, just redefine "return". Easy.There may be side-effects.
21
The times code design is about what it actually does instead of what we think it does are long gone
4
If it's doing something with global variables?
13 u/coderman64 Mar 03 '26 No, the first return exits the function entirely, so the second will never be executed.It's a basic mistake that most linters will warn you about. 2 u/FloydATC Mar 04 '26 Pff, just redefine "return". Easy.There may be side-effects.
13
No, the first return exits the function entirely, so the second will never be executed.
It's a basic mistake that most linters will warn you about.
2 u/FloydATC Mar 04 '26 Pff, just redefine "return". Easy.There may be side-effects.
2
Pff, just redefine "return". Easy.
There may be side-effects.
7
How is this not a compile error?
18 u/Stolberger Mar 02 '26 Usually it is just flagged as a warning "unreachable code", but might depend on the language and/or compiler and/or IDE 3 u/Gsusruls Mar 03 '26 And/or ci linting tool
18
Usually it is just flagged as a warning "unreachable code", but might depend on the language and/or compiler and/or IDE
3 u/Gsusruls Mar 03 '26 And/or ci linting tool
3
And/or ci linting tool
Bravo future tech lead
Sometimes it even may work...
function example() { try { return recalculate() } finally { return recalculate() } }
View all comments
238
u/talbakaze Mar 02 '26 •
return recalculate()
return recalculate()
the comment stated that it had to be recalculated twice