Q:

C++ switch statement evaluation

Assume we have a following code:
switch (currentChar) {
    case 'G':
    case 'T':                   
    case 'M':
    case ';':                       
    case '\r':                      
    case '\n':  
        doSomething();      
        break;
}

If the first condition is met (currentChar == 'G') are the following cases also compared, or the program jumps straight to doSomething()?
What would be faster to execute: the switch-case, or an if with || operator?
Clarification:
I want doSomething to be executed if any of the conditions is met. I also know that the 'G' case will occur in some 99% of all cases. Can I assume that it will be compared as the first if I put it on top of the list?

A:

If the first condition is met (currentChar == 'G') are the following cases also evaluated, or the program jumps straight to doSomething()?

It will immediately jump to execute doSomething()

What would be faster to execute: the switch-case, or an if with || operator?

I don't think it would make any difference with any decent modern c++ compiler, and the emitted code should be fairly the same.

