Unnecessary lines in stem.c?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Unnecessary lines in stem.c?

S Ellison-2
A discussion on r-help led me to look at stem.c at
https://github.com/wch/r-source/blob/trunk/src/library/graphics/src/stem.c

Lines 76-77 appear superfluous. They sit inside a condition, and set mu, as follows:
        if (k*(k-4)*(k-8) == 0) mu = 5;
        if ((k-1)*(k-5)*(k-6) == 0) mu = 20;

But mu is set unconditionally to 10 on line 84, and that is followed by conditional assignments (on line 85-6) identical to lines 76-77.

It looks like a couple of lines got left inside a condition that are no longer needed there. If that is correct, is it worth removing the superfluous lines, for future coders' benefit?

S Ellison
 


*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Unnecessary lines in stem.c?

Tomas Kalibera
Thanks! Cleaned up in R-devel,
Tomas

On 02/16/2018 05:03 PM, S Ellison wrote:

> A discussion on r-help led me to look at stem.c at
> https://github.com/wch/r-source/blob/trunk/src/library/graphics/src/stem.c
>
> Lines 76-77 appear superfluous. They sit inside a condition, and set mu, as follows:
> if (k*(k-4)*(k-8) == 0) mu = 5;
> if ((k-1)*(k-5)*(k-6) == 0) mu = 20;
>
> But mu is set unconditionally to 10 on line 84, and that is followed by conditional assignments (on line 85-6) identical to lines 76-77.
>
> It looks like a couple of lines got left inside a condition that are no longer needed there. If that is correct, is it worth removing the superfluous lines, for future coders' benefit?
>
> S Ellison
>  
>
>
> *******************************************************************
> This email and any attachments are confidential. Any u...{{dropped:7}}

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel