Versions Compared

Key

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

...

Code Block
bgColor#ccccff
enum et1 {
  E_A,
  E_B
};

int i1 = -1;

if (i1 < 0 || i1 > E_CB) {
  /* error condition */
}

et1 e1 = static_cast<et1>(i1);

...

Code Block
bgColor#ccccff
enum et1 {
  E_A,
  E_B
};

int i1 = 5;

if (i1 < 0 || i1 > E_CB) {
  /* error condition */
}

switch(static_cast<et1>(i1)) {
  case E_A:
    /* some action A */
  case E_B:
    /* some action B */
}

...