Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 6-3-1: Does it also apply to "case" blocks?
#1
Consider this piece of code:

Code:
enum Foo
{
  a,
  b
};


void foo(Foo f)
{
  switch(f)
  {
    case a:
      std::cout << "a\n";
      break;
    case b:
      std::cout << "b\n";
      break;
  }

}

Is the above compliant with M6-3-1, or does one need to add braces also to the "case" blocks, e.g.:

Code:
case a:
{
  std::cout << "a\n";
  break;
}

Thanks!
Reply


Messages In This Thread
Rule 6-3-1: Does it also apply to "case" blocks? - by cgpzs - 24-08-2023, 12:05 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)