Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: decamelcased

...

Code Block
bgColor#FFcccc
langc
float calcPercentagecalc_percentage(float value) {
  return value * 0.1f;
}

void floatRoutinefloat_routine(void) {
  float value = 99.0f;
  long double percentage;

  percentage = calcPercentagecalc_percentage(value);
}

Compliant Solution (Cast)

...

Code Block
bgColor#ccccff
langc
float calcPercentagecalc_percentage(float value) {
  return (float)(value * 0.1f);
}

void floatRoutinefloat_routine(void) {
  float value = 99.0f;
  long double percentage;

  percentage = calcPercentagecalc_percentage(value);
}

Compliant Solution (Within the Function)

...

Code Block
bgColor#ccccff
langc
void floatRoutinefloat_routine(void) {
  float value = 99.0f;
  long double percentage;
  volatile float temp;

  percentage = temp = calcPercentagecalc_percentage(value);
}

Compliant Solution (Outside the Function)

...

Code Block
bgColor#ccccff
langc
void floatRoutinefloat_routine(void) {
  float value = 99.0f;
  long double percentage;

  percentage = (float)calcPercentage calc_percentage(value);
}

Risk Assessment

...