Click here to Skip to main content
15,893,487 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
AnswerRe: Multiple returns from methods or clean code flow Pin
CodeWraith15-Feb-19 7:05
CodeWraith15-Feb-19 7:05 
AnswerRe: Multiple returns from methods or clean code flow Pin
Gerry Schmitz15-Feb-19 7:33
mveGerry Schmitz15-Feb-19 7:33 
AnswerRe: Multiple returns from methods or clean code flow Pin
ZurdoDev15-Feb-19 7:50
professionalZurdoDev15-Feb-19 7:50 
GeneralRe: Multiple returns from methods or clean code flow Pin
Gerry Schmitz15-Feb-19 8:08
mveGerry Schmitz15-Feb-19 8:08 
GeneralRe: Multiple returns from methods or clean code flow Pin
ZurdoDev15-Feb-19 8:12
professionalZurdoDev15-Feb-19 8:12 
GeneralRe: Multiple returns from methods or clean code flow Pin
CodeWraith15-Feb-19 8:16
CodeWraith15-Feb-19 8:16 
GeneralRe: Multiple returns from methods or clean code flow Pin
ZurdoDev15-Feb-19 8:18
professionalZurdoDev15-Feb-19 8:18 
GeneralRe: Multiple returns from methods or clean code flow Pin
CodeWraith15-Feb-19 8:51
CodeWraith15-Feb-19 8:51 
ZurdoDev wrote:
That's when you throw an exception.
In what way is that better than an early return if your goal is to have a single return point? And catching it yourself at the end of your function does not justify the overhead of throwing an exception. The dreaded GOTO would then be cheaper and no more or less problematic.

ZurdoDev wrote:
Maybe breaking things into functions would be better.
Unless you can't afford to bog down the processor with too much overhead of packing parameters onto the stack or cleaning it up afterwards. On a strong processor that's no big deal anymore, but often enough I sit there with a C compiler and a small microcontroller clocked < 10 MHz. Usually some output pins need to be pulled up or down according to a certain timing, leaving me only a few machine instructions on the microcontroller within that timeframe. In that case I may have to resort to inline assembly and can't afford any function calls.
I have lived with several Zen masters - all of them were cats.

His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.

GeneralRe: Multiple returns from methods or clean code flow Pin
ZurdoDev15-Feb-19 9:03
professionalZurdoDev15-Feb-19 9:03 
GeneralRe: Multiple returns from methods or clean code flow Pin
CodeWraith15-Feb-19 9:47
CodeWraith15-Feb-19 9:47 
GeneralRe: Multiple returns from methods or clean code flow Pin
kalberts17-Feb-19 22:02
kalberts17-Feb-19 22:02 
GeneralRe: Multiple returns from methods or clean code flow Pin
Mark_Wallace15-Feb-19 10:33
Mark_Wallace15-Feb-19 10:33 
GeneralRe: Multiple returns from methods or clean code flow Pin
CodeWraith17-Feb-19 22:48
CodeWraith17-Feb-19 22:48 
GeneralRe: Multiple returns from methods or clean code flow Pin
Mark_Wallace18-Feb-19 6:52
Mark_Wallace18-Feb-19 6:52 
AnswerRe: Multiple returns from methods or clean code flow Pin
MarkTJohnson15-Feb-19 8:16
professionalMarkTJohnson15-Feb-19 8:16 
AnswerRe: Multiple returns from methods or clean code flow Pin
Maximilien15-Feb-19 8:17
Maximilien15-Feb-19 8:17 
GeneralRe: Multiple returns from methods or clean code flow Pin
  Forogar  15-Feb-19 8:24
professional  Forogar  15-Feb-19 8:24 
QuestionRe: Multiple returns from methods or clean code flow Pin
megaadam17-Feb-19 22:23
professionalmegaadam17-Feb-19 22:23 
AnswerRe: Multiple returns from methods or clean code flow Pin
User 1106097915-Feb-19 8:25
User 1106097915-Feb-19 8:25 
AnswerRe: Multiple returns from methods or clean code flow Pin
Rajesh R Subramanian15-Feb-19 9:11
professionalRajesh R Subramanian15-Feb-19 9:11 
AnswerRe: Multiple returns from methods or clean code flow Pin
Slacker00715-Feb-19 10:19
professionalSlacker00715-Feb-19 10:19 
AnswerRe: Multiple returns from methods or clean code flow Pin
Mark_Wallace15-Feb-19 10:27
Mark_Wallace15-Feb-19 10:27 
AnswerRe: Multiple returns from methods or clean code flow Pin
Tim Deveaux15-Feb-19 12:18
Tim Deveaux15-Feb-19 12:18 
GeneralRe: Multiple returns from methods or clean code flow Pin
Mark_Wallace15-Feb-19 12:53
Mark_Wallace15-Feb-19 12:53 
GeneralRe: Multiple returns from methods or clean code flow Pin
Tim Deveaux15-Feb-19 13:26
Tim Deveaux15-Feb-19 13:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.