initialize variables, add 'default:'

This commit is contained in:
Jim Monte 2020-04-25 19:37:42 +02:00 committed by Holger Vogt
parent 8892d996e6
commit 4c67a2846b
3 changed files with 6 additions and 4 deletions

View File

@ -259,8 +259,10 @@ void cm_pwl(ARGS) /* structure holding parms,
double lower_slope; /* slope of the lower segment */ double lower_slope; /* slope of the lower segment */
double upper_slope; /* slope of the upper segment */ double upper_slope; /* slope of the upper segment */
double x_input; /* input */ double x_input; /* input */
double out; /* output */ double out = 0.0; /* output
double dout_din; /* partial derivative of the output wrt input */ * Init to 0 to suppress compiler warning */
double dout_din = 0.0; /* partial derivative of the output wrt input.
* Init to 0 to suppress compiler warning */
double threshold_lower; /* value below which the output begins smoothing */ double threshold_lower; /* value below which the output begins smoothing */
double threshold_upper; /* value above which the output begins smoothing */ double threshold_upper; /* value above which the output begins smoothing */
double test1; /* debug testing value */ double test1; /* debug testing value */

View File

@ -187,7 +187,7 @@ static Digital_State_t cm_eval_jk_result(Digital_State_t j_input,
Digital_State_t k_input, Digital_State_t k_input,
Digital_State_t old_output) Digital_State_t old_output)
{ {
Digital_State_t output; /* returned output value */ Digital_State_t output = UNKNOWN; /* returned output value */
switch (j_input) { switch (j_input) {
@ -228,7 +228,6 @@ static Digital_State_t cm_eval_jk_result(Digital_State_t j_input,
} }
return output; return output;
} }
/*============================================================================== /*==============================================================================

View File

@ -580,6 +580,7 @@ void cm_d_tff(ARGS)
temp = *out_old; temp = *out_old;
break; break;
case UNKNOWN: case UNKNOWN:
default:
temp = UNKNOWN; temp = UNKNOWN;
break; break;
} }