Lucky hour! Grab a free trial license — offer ends in 00:59:58. Claim now
The analyzer has detected that multiple case clauses of the switch statement contain the same code. This error may occur as a result of copying code. This may cause part of the program logic to stop working.
The example:
switch msg {
case "start":
Start()
case "stop":
Start()
}
In some cases, different case labels require the same actions. To enhance readability, the implementation can be streamlined:
switch msg {
case "start":
Start()
case "stop":
Stop()
}
Identical case bodies may be intentional, but they can still make the code ambiguous.
The example:
switch msg {
case "start":
Start()
case "begin":
Start()
default:
Stop()
}
In this example, the same code is used for the start and begin cases, which may later be ambiguous.
To enhance clarity, the code can be rewritten as follows:
switch msg {
case "start", "begin":
Start()
default:
Stop()
}
You can look at examples of errors detected by the V8009 diagnostic. |
Was this page helpful?
Your message has been sent. We will email you at
If you do not see the email in your inbox, please check if it is filtered to one of the following folders: