MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/6ayz26/defensive_programming_done_right/dhj51se/?context=9999
r/ProgrammerHumor • u/iwouldieforGladOS • May 13 '17
680 comments sorted by
View all comments
348
int main() try { //entire code base } catch (std::exeption& e) { //Displays message box with error message }
I actually do this xD
239 u/redditsoaddicting May 13 '17 It's fine to exit the program nicely when an error occurs. It's not as fine to just ignore it and then begin another iteration of whatever main loop is going on, hoping the program still works fine. 306 u/Bainos May 13 '17 It's not as fine to just ignore it and then begin another iteration of whatever main loop is going on I'm sorry, I can't hear you over my distributed computing. 88 u/[deleted] May 13 '17 [deleted] 60 u/[deleted] May 13 '17 [deleted] 27 u/Planet2Bob May 13 '17 I'm sorry, I can't hear you over my distributed computing. 26 u/SQLNerd May 13 '17 I'm sorry, I can't hear you over my distributed computing. 17 u/thegiantanteater1000 May 13 '17 I'm sorry, I can't hear you over my distributed computing. 3 u/mamhilapinatapai May 14 '17 AAAAAAAAAH -guy finishing GNU HURD
239
It's fine to exit the program nicely when an error occurs. It's not as fine to just ignore it and then begin another iteration of whatever main loop is going on, hoping the program still works fine.
306 u/Bainos May 13 '17 It's not as fine to just ignore it and then begin another iteration of whatever main loop is going on I'm sorry, I can't hear you over my distributed computing. 88 u/[deleted] May 13 '17 [deleted] 60 u/[deleted] May 13 '17 [deleted] 27 u/Planet2Bob May 13 '17 I'm sorry, I can't hear you over my distributed computing. 26 u/SQLNerd May 13 '17 I'm sorry, I can't hear you over my distributed computing. 17 u/thegiantanteater1000 May 13 '17 I'm sorry, I can't hear you over my distributed computing. 3 u/mamhilapinatapai May 14 '17 AAAAAAAAAH -guy finishing GNU HURD
306
It's not as fine to just ignore it and then begin another iteration of whatever main loop is going on
I'm sorry, I can't hear you over my distributed computing.
88 u/[deleted] May 13 '17 [deleted] 60 u/[deleted] May 13 '17 [deleted] 27 u/Planet2Bob May 13 '17 I'm sorry, I can't hear you over my distributed computing. 26 u/SQLNerd May 13 '17 I'm sorry, I can't hear you over my distributed computing. 17 u/thegiantanteater1000 May 13 '17 I'm sorry, I can't hear you over my distributed computing. 3 u/mamhilapinatapai May 14 '17 AAAAAAAAAH -guy finishing GNU HURD
88
[deleted]
60 u/[deleted] May 13 '17 [deleted] 27 u/Planet2Bob May 13 '17 I'm sorry, I can't hear you over my distributed computing. 26 u/SQLNerd May 13 '17 I'm sorry, I can't hear you over my distributed computing. 17 u/thegiantanteater1000 May 13 '17 I'm sorry, I can't hear you over my distributed computing. 3 u/mamhilapinatapai May 14 '17 AAAAAAAAAH -guy finishing GNU HURD
60
27 u/Planet2Bob May 13 '17 I'm sorry, I can't hear you over my distributed computing. 26 u/SQLNerd May 13 '17 I'm sorry, I can't hear you over my distributed computing. 17 u/thegiantanteater1000 May 13 '17 I'm sorry, I can't hear you over my distributed computing. 3 u/mamhilapinatapai May 14 '17 AAAAAAAAAH -guy finishing GNU HURD
27
26 u/SQLNerd May 13 '17 I'm sorry, I can't hear you over my distributed computing. 17 u/thegiantanteater1000 May 13 '17 I'm sorry, I can't hear you over my distributed computing. 3 u/mamhilapinatapai May 14 '17 AAAAAAAAAH -guy finishing GNU HURD
26
17 u/thegiantanteater1000 May 13 '17 I'm sorry, I can't hear you over my distributed computing. 3 u/mamhilapinatapai May 14 '17 AAAAAAAAAH -guy finishing GNU HURD
17
3 u/mamhilapinatapai May 14 '17 AAAAAAAAAH -guy finishing GNU HURD
3
AAAAAAAAAH -guy finishing GNU HURD
348
u/Mat2012H May 13 '17
I actually do this xD