Re: OT if/else or not if/else

2016-04-26 Thread Christopher Schultz
Chuck, On 4/26/16 12:18 PM, Caldarale, Charles R wrote: >> From: Christopher Schultz [mailto:ch...@christopherschultz.net] >> Subject: Re: OT if/else or not if/else > >> Unless the JIT can prove that there are no side-effects, it's not >> going to perform a

RE: OT if/else or not if/else

2016-04-26 Thread Caldarale, Charles R
> From: Christopher Schultz [mailto:ch...@christopherschultz.net] > Subject: Re: OT if/else or not if/else > Unless the JIT can prove that there are no side-effects, it's not > going to perform any speculative computations for a possible branch. True, but due to inlining of

Re: OT if/else or not if/else

2016-04-26 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Chuck, On 4/25/16 4:54 PM, Caldarale, Charles R wrote: >> From: Christopher Schultz [mailto:ch...@christopherschultz.net] >> Subject: Re: OT if/else or not if/else > >> If you use else-less-if, then there is

RE: OT if/else or not if/else

2016-04-25 Thread Caldarale, Charles R
> From: Christopher Schultz [mailto:ch...@christopherschultz.net] > Subject: Re: OT if/else or not if/else > If you use else-less-if, then there is never an opportunity for > parellelization, since the program is going to assume that those > predicates are (a) independent

Re: OT if/else or not if/else

2016-04-25 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Leon, On 4/25/16 10:38 AM, Leon Rosenberg wrote: > On Mon, Apr 25, 2016 at 4:13 PM, Christopher Schultz < > ch...@christopherschultz.net> wrote: > > Leon, > > On 4/22/16 12:24 PM, Leon Rosenberg wrote: Hi guys, > > I would always

Re: OT if/else or not if/else

2016-04-25 Thread David kerber
On 4/25/2016 11:44 AM, Leon Rosenberg wrote: On Mon, Apr 25, 2016 at 5:21 PM, Dougherty, Gregory T., M.S. < dougherty.greg...@mayo.edu> wrote: Yes, we do, because, well, it is more informative. :-) if (a) Š else if (b) Š else if (c) Š Says you have three mutually exclusive options, and

Re: OT if/else or not if/else

2016-04-25 Thread Dougherty, Gregory T., M.S.
On 4/25/16, 10:44 AM, "Leon Rosenberg" wrote: >On Mon, Apr 25, 2016 at 5:21 PM, Dougherty, Gregory T., M.S. < >dougherty.greg...@mayo.edu> wrote: > >> >> >> Yes, we do, because, well, it is more informative. :-) >> >> if (a) Š >> else if (b) Š >> else if (c) Š >> >>

Re: OT if/else or not if/else

2016-04-25 Thread Leon Rosenberg
On Mon, Apr 25, 2016 at 5:21 PM, Dougherty, Gregory T., M.S. < dougherty.greg...@mayo.edu> wrote: > > > Yes, we do, because, well, it is more informative. :-) > > if (a) Š > else if (b) Š > else if (c) Š > > Says you have three mutually exclusive options, and implies that a is more > likely /

Re: OT if/else or not if/else

2016-04-25 Thread tomcat
On 25.04.2016 17:21, Dougherty, Gregory T., M.S. wrote: On 4/25/16, 9:38 AM, "Leon Rosenberg" wrote: The other thing that made me wonder is that most people on the list (or all except me) actually considered if-else-if-else more readable. It not only creates a more

Re: OT if/else or not if/else

2016-04-25 Thread Dougherty, Gregory T., M.S.
On 4/25/16, 9:38 AM, "Leon Rosenberg" wrote: >The other thing that made me wonder is that most people on the list (or >all >except me) actually considered if-else-if-else more readable. It not only >creates a more complex structure (visually and syntactically (more

Re: OT if/else or not if/else

2016-04-25 Thread tomcat
On 25.04.2016 16:38, Leon Rosenberg wrote: On Mon, Apr 25, 2016 at 4:13 PM, Christopher Schultz < ch...@christopherschultz.net> wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Leon, On 4/22/16 12:24 PM, Leon Rosenberg wrote: Hi guys, I would always choose the case with the elses.

Re: OT if/else or not if/else

2016-04-25 Thread David kerber
On 4/25/2016 10:38 AM, Leon Rosenberg wrote: On Mon, Apr 25, 2016 at 4:13 PM, Christopher Schultz < ch...@christopherschultz.net> wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Leon, On 4/22/16 12:24 PM, Leon Rosenberg wrote: Hi guys, I would always choose the case with the elses.

Re: OT if/else or not if/else

2016-04-25 Thread Leon Rosenberg
On Mon, Apr 25, 2016 at 4:13 PM, Christopher Schultz < ch...@christopherschultz.net> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Leon, > > On 4/22/16 12:24 PM, Leon Rosenberg wrote: > > Hi guys, > > > > I would always choose the case with the elses. > > First, I think it's more

RE: OT if/else or not if/else

2016-04-25 Thread Caldarale, Charles R
> From: Christopher Schultz [mailto:ch...@christopherschultz.net] > Subject: Re: OT if/else or not if/else > > Actually, a good compiler should generate the same code for switch > > and if ... else if, assuming the boolean expressions used with the > > ifs are compatib

Re: OT if/else or not if/else

2016-04-25 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Chuck, On 4/22/16 12:54 PM, Caldarale, Charles R wrote: >> From: David kerber [mailto:dcker...@verizon.net] Subject: Re: OT >> if/else or not if/else > >> But I would add that if the conditions can be reduced to >> e

Re: OT if/else or not if/else

2016-04-25 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Leon, On 4/22/16 12:24 PM, Leon Rosenberg wrote: > Hi guys, > > this is completely off-topic ;-) > > I was wondering if using if/else is not actually slowing down your > code. Lets say I have three possible conditions, A, B and C, which > are

Re: OT if/else or not if/else

2016-04-23 Thread Olaf Kock
Am 23.04.2016 um 12:19 schrieb André Warnier (tomcat): > Since it is still week-end.. > > On 22.04.2016 21:57, Olaf Kock wrote: >> Optimize for the maintainer, not for the compiler. The maintainer might >> buy you a beer, the compiler for sure will not. > > With permission, I will borrow that

Re: OT if/else or not if/else

2016-04-23 Thread tomcat
Since it is still week-end.. On 22.04.2016 21:57, Olaf Kock wrote: Optimize for the maintainer, not for the compiler. The maintainer might buy you a beer, the compiler for sure will not. With permission, I will borrow that paragraph for my upcoming "Programming for Dummies" book. This is

Re: OT if/else or not if/else

2016-04-22 Thread Baran Topal
if else i prefer. Multiple ifs sounds like a political programming and you are not sure what you are doing. 22 Nisan 2016 Cuma tarihinde, Leon Rosenberg yazdı: > Hi guys, > > this is completely off-topic ;-) > > I was wondering if using if/else is not actually slowing

Re: OT if/else or not if/else

2016-04-22 Thread Olaf Kock
Am 22.04.2016 um 18:24 schrieb Leon Rosenberg: > Hi guys, > > this is completely off-topic ;-) > > I was wondering if using if/else is not actually slowing down your code. > Lets say I have three possible conditions, A, B and C, which are exclusive. > My native approach would be: > if (A){...} >

Re: OT if/else or not if/else

2016-04-22 Thread Tim Watts
On Fri, 2016-04-22 at 17:34 +0100, Mark Thomas wrote: > On 22/04/2016 17:24, Leon Rosenberg wrote: > > Lets say I have three possible conditions, A, B and C, which are exclusive. > > My native approach would be: > > if (A){...} > > if (B){...} > > if (C){...} > > > > now some people would

RE: OT if/else or not if/else

2016-04-22 Thread Caldarale, Charles R
> From: Leon Rosenberg [mailto:rosenberg.l...@gmail.com] > Subject: OT if/else or not if/else > I was wondering if using if/else is not actually slowing down your code. > Lets say I have three possible conditions, A, B and C, which are exclusive. > My native

RE: OT if/else or not if/else

2016-04-22 Thread Caldarale, Charles R
> From: David kerber [mailto:dcker...@verizon.net] > Subject: Re: OT if/else or not if/else > But I would add that if the conditions can be reduced to enumerations, a > Switch would be even faster. Actually, a good compiler should generate the same code for switch and if ... else

Re: OT if/else or not if/else

2016-04-22 Thread David kerber
On 4/22/2016 12:34 PM, Mark Thomas wrote: On 22/04/2016 17:24, Leon Rosenberg wrote: Hi guys, this is completely off-topic ;-) Excellent. An almost perfect Friday afternoon distraction. You just needed some decent troll bait to make it perfect. ;) I was wondering if using if/else is not

Re: OT if/else or not if/else

2016-04-22 Thread James H. H. Lampert
But what is now, given that compilers can optimize stuff like this and tell the processor to calculate all 3 branches simultaneously, which is not possible for ifelse. Which one would you choose? Equally important, which one do you think is more readable? I would say if else is hard to read, but

Re: OT if/else or not if/else

2016-04-22 Thread Mark Thomas
On 22/04/2016 17:24, Leon Rosenberg wrote: > Hi guys, > > this is completely off-topic ;-) Excellent. An almost perfect Friday afternoon distraction. You just needed some decent troll bait to make it perfect. ;) > I was wondering if using if/else is not actually slowing down your code. > Lets

OT if/else or not if/else

2016-04-22 Thread Leon Rosenberg
Hi guys, this is completely off-topic ;-) I was wondering if using if/else is not actually slowing down your code. Lets say I have three possible conditions, A, B and C, which are exclusive. My native approach would be: if (A){...} if (B){...} if (C){...} now some people would 'optimize' it as