Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#FFCCCC
#define PI 3.1415914159f
float degrees;
float radians;
/* ... */
radians = degrees * PI / 180;

...

Compliant Solution

In this compliant solution, pi is declared as a const-qualified object, allowing the constant to have scope and to have its value inspected by a debugger.

Code Block
bgColor#ccccff
const float pi = 3.1415914159f;
float degrees;
float radians;
/* ... */
radians = degrees * pi / 180;

...