Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suspicious unused argument #5

Open
akhenakh opened this issue Feb 14, 2020 · 2 comments
Open

suspicious unused argument #5

akhenakh opened this issue Feb 14, 2020 · 2 comments

Comments

@akhenakh
Copy link
Contributor

I'm working of cleaning the code with some linters and found this

dspace.go:18:371: SA4009: argument dedt is overwritten before first use (staticcheck)
func dsinit(whichconst GravConst, cosim, emsq, argpo, s1, s2, s3, s4, s5, sinim, ss1, ss2, ss3, ss4, ss5, sz1, sz3, sz11, sz13, sz21, sz23, sz31, sz33, t, tc, gsto, mo, mdot, no, nodeo, nodedot, xpidot, z1, z3, z11, z13, z21, z23, z31, z33, ecco, eccsq, em, argpm, inclm, mm, nm, nodem, irez, atime, d2201, d2211, d3210, d3222, d4410, d4422, d5220, d5232, d5421, d5433, dedt, didt, dmdt, dnodt, domdt, del1, del2, del3, xfact, xlamo, xli, xni float64) (res DeepSpaceInitResult) {
                                                                                                                                                                                                                                                                                                                                                                                  ^
dspace.go:462:52: SA4009: argument e3 is overwritten before first use (staticcheck)
func dscom(epoch, ep, argpp, tc, inclp, nodep, np, e3, ee2, peo, pgho, pho, pinco, plo, se2, se3, sgh2, sgh3, sgh4, sh2, sh3, si2, si3, sl2, sl3, sl4, xgh2, xgh3, xgh4, xh2, xh3, xi2, xi3, xl2, xl3, xl4, zmol, zmos float64) (res DSComResults) {

For example e3 = 2.0 * s1 * s7 is assigned before read

@joshuaferrara
Copy link
Owner

These two in particular are meant to be outputs of these methods according to the original function headers - should've included those when I ported the library...

I've done a brief look-over, and it's kinda silly to pass these into the function when they're meant to be outputs. It'd be ideal to go through the headers of the original implementation and make changes to the function declarations here to align them. I believe these were essentially passed-by-reference variables in the original implementation.

@joshuaferrara
Copy link
Owner

Linking my other comment here as well; this indicates the root-cause of these issues: #7 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants