Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #38229

Re: Exit from loop?

From Daniele Futtorovic <da.futt.news@laposte.net>
Newsgroups comp.lang.java.programmer
Subject Re: Exit from loop?
Date 2018-04-06 18:19 +0200
Organization A noiseless patient Spider
Message-ID <pa86no$dln$1@dont-email.me> (permalink)
References <6f19094e-c652-44e0-8a7d-fb3b7791c372@googlegroups.com> <pa38s0$35o$1@gioia.aioe.org> <cdaa9694-0267-45d2-80f4-5362ac858ceb@googlegroups.com>

Show all headers | View raw


On 2018-04-04 21:44, Eric Douglas wrote:
> There are coding preferences to always exit from a single point, but if the language doesn't care, sometimes it's easier to exit in the middle of the loop structure if there's nothing you need to do after the loop.  If it's bad for the language ie messing with the garbage collector, we should always exit properly with the break.
> 

The language doesn't care. It's a matter of readability.

Yes, arguably, single-return can make code analysis easier, and might
enable more advanced JIT-like voodoo. In my experience and for most
practical concerns, that's negligible, however.

-- 
DF.

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Exit from loop? Eric Douglas <e.d.programmer@gmail.com> - 2018-04-04 12:05 -0700
  Re: Exit from loop? Arne Vajhøj <arne@vajhoej.dk> - 2018-04-04 15:25 -0400
    Re: Exit from loop? Eric Douglas <e.d.programmer@gmail.com> - 2018-04-04 12:44 -0700
      Re: Exit from loop? Arne Vajhøj <arne@vajhoej.dk> - 2018-04-04 19:51 -0400
        Re: Exit from loop? Martin Gregorie <martin@mydomain.invalid> - 2018-04-05 10:46 +0000
      Re: Exit from loop? Daniele Futtorovic <da.futt.news@laposte.net> - 2018-04-06 18:19 +0200

csiph-web