[Kstars-devel] Proposal for removal

Akarsh Simha akarshsimha at gmail.com
Thu Jun 11 15:21:43 CEST 2009


> KSasteriod class has two constructors. 
> 
> First: 
> >KSAsteroid( const QString &s, const QString &image_file,
> >   long double JD, double a, double e, dms i, dms w, dms N, dms M, double H,
> >   double G );
> 
> Second is same but set slope parameter to unsensible value (-1).
> >KSAsteroid( const QString &s, const QString &image_file,
> >   long double JD, double a, double e, dms i, dms w, dms N, dms M, double H)
> 
> It's implementation is broken. 
> >KSAsteroid::KSAsteroid( ... )
> >	: KSPlanetBase(s, imfile),
> >      JD(_JD), a(_a), e(_e), i(_i), w(_w), M(_M), N(_Node), H(_H)
> >{
> >    KSAsteroid(s, imfile, _JD, _a, _e, _i, _w, _Node, _M, _H, -1);
> Here it doesn't call another constructor. It's impossible. Instead it create 
> temporary object and throw it away immediatly. Thus some fields in object 
> aren't initialized.

> It's marked for use in KSPluto but it's not used there. It isn't used 
> anywhere. I think if someone do not know slope parameter it's better to force 
> him to make some assuptions than to make them silently. 
> 
> Or default parameter [..., G = -1.0); ] could be added to working constructor. 
> But I think that's not required. 

Fair enough. I agree that you should throw away the broken
constructor.

Are you sure that G is not tested for -1.0 anywhere? If I'm right, G
can only be positive and -1.0 is a fake value to indicate that G has
not been defined. I think it is "safer" to leave it at it's default
value, but if you're sure of what you're doing, please go ahead.

Regards
Akarsh


More information about the Kstars-devel mailing list