Re: [RFC] Disallow multiple default blocks in a single switch statement
| From: | Ferenc Kovacs | Date: | Wed, 13 Aug 2014 13:50:27 +0000 |
| Subject: | Re: [RFC] Disallow multiple default blocks in a single switch statement | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-76485@lists.php.net to get a copy of this message | ||
On Wed, Aug 13, 2014 at 3:42 PM, Rowan Collins <rowan.collins@gmail.com>
wrote:
> Ferenc Kovacs wrote (on 13/08/2014):
>
>>
>> It is not selecting the first default, it just never needs to look
>> for a default, because it has already found a matching case label.
>>
>>
>> yes, and it continues the execution from the first matching case and
>> correctly evaluates the following defaults, as default matches everything,
>> which imo should be the correct behavior.
>>
>
> No, it does not "evaluate the following defaults"; it evaluates all
> following code. Once a label has been selected, you can think of all
> subsequent labels being removed from the code completely.
>
>
duh, that was embarrassing, thanks for bearing with me until I realized
that. :S
--
Ferenc Kovács
@Tyr43l - http://tyrael.hu