Re:Software development topics I've changed my mind on after...
by pinoy420 on Wednesday February 05, 2025 @10:07AM
(#42949472)
How many errors are actually recoverable. I bet most thrown exceptions could be replaced with a printf(“it went wrong here”) for all their utility.
[ Parent
| on HN ]
Re:Software development topics I've changed my mind on after...
by bluGill on Wednesday February 05, 2025 @10:33AM
(#42949926)
I disagree. The real value of exceptions is you can skip 6 levels of functions that have lines like
status = DoThing(); if(status != allIsWell) {return status;}
C++ embedded for a long time has said don't use exceptions they are slow. However recent thinking has changed - turns out in trivial code exceptions are slow but in more real world code exceptions are faster than all those layers if checks - and better yet you won't give up on writing all the if checks. Thus embedded projects are starting turn exceptions on (often optimized exceptions with static pre allocated buffers)
The final "print something when wrong" is of little value, but the unwinding is very valuable.
Re:Software development topics I've changed my mind on after...
by hasley on Wednesday February 05, 2025 @11:47AM
(#42951252)
Do you have any references for that? I used to avoid exceptions on small Cortex M0/M3 devices as well.
Re:Software development topics I've changed my mind on after...
by bluGill on Wednesday February 05, 2025 @12:48PM
(#42952302)
Khalil Estell has some great work on that. https://www.youtube.com/watch?v=bY2FlayomlE is one link - very low level technical of what is really happening. He has other talks and papers if you search his name.
Re:Software development topics I've changed my mind on after...
by hasley on Wednesday February 05, 2025 @02:42PM
(#42953984)
Nice, thank you!
Re:Software development topics I've changed my mind on after...
by ackfoobar on Wednesday February 05, 2025 @03:57PM
(#42955003)
> The real value of exceptions is you can skip 6 levels of functions that have lines like
For some reason some Go programmers think those lines are the best thing since sliced bread.
Re:Software development topics I've changed my mind on after...
by The_Colonel on Wednesday February 05, 2025 @10:20AM
(#42949677)
Well, usually you want to handle it at some level - e.g. a common REST exception handler returning a standard 500 response with some details about what went wrong. Or retry the process (sometimes the errors may be intermittent)