Skip to content

Commit 95d0360

Browse files
committed
I got a 'possibly uninitialized variable' warning for the nominal_r and nominal_rv variables in debug builds. In non-debug builds, the optimizer recognizes that those variables will inevitably be set, but debug builds skip that procedure. I also realized that 'computer friendly' (high precision) residuals would overflow the buffer if abs(resid)>=10 arcseconds; the text is now truncated correctly, without producing an error.
1 parent 943d609 commit 95d0360

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ephem0.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2499,7 +2499,7 @@ static int _ephemeris_in_a_file( const char *filename, const double *orbit,
24992499
long rgb = 0;
25002500
double sum_r = 0., sum_r2 = 0.; /* for uncertainty in r */
25012501
double sum_rv = 0., sum_rv2 = 0.; /* for uncertainty in rvel */
2502-
double nominal_r, nominal_rv;
2502+
double nominal_r = 0., nominal_rv = 0.;
25032503

25042504
if( use_observation_times)
25052505
{
@@ -3832,7 +3832,7 @@ static void put_residual_into_text( char *text, const double resid,
38323832

38333833
if( resid_format & RESIDUAL_FORMAT_COMPUTER_FRIENDLY)
38343834
{ /* resids in arcseconds at all times, with */
3835-
snprintf_err( text, 11, " %+8.6f", resid); /* some added precision */
3835+
snprintf( text, 11, " %+8.6f", resid); /* some added precision */
38363836
return;
38373837
}
38383838
if( zval > 999. * 3600.) /* >999 degrees: error must have occurred */

0 commit comments

Comments
 (0)