2020-06-30 12:49:37 +02:00
|
|
|
include::../description.adoc[]
|
|
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
|
|
|
|
----
|
|
|
|
switch (param)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
DoSomething();
|
|
|
|
break;
|
|
|
|
default: // default clause should be the first or last one
|
|
|
|
Error();
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
DoSomethingElse();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
----
|
|
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
|
|
|
|
----
|
|
|
|
switch (param)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
DoSomething();
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
DoSomethingElse();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
Error();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
----
|
2021-06-02 20:44:38 +02:00
|
|
|
|
|
|
|
ifdef::rspecator-view[]
|
|
|
|
== Comments And Links
|
|
|
|
(visible only on this page)
|
|
|
|
|
|
|
|
include::../comments-and-links.adoc[]
|
|
|
|
endif::rspecator-view[]
|