[Devel] break is not allowed in switch statement?
Daniel-Constantin Mierla
daniel at voice-system.ro
Thu Dec 15 20:13:49 CET 2005
Hello,
I introduced the option to have empty action list for 'case' and
'default' statements. Please let me know if it works, I did just few
testing.
Note that 'default' statement must be the last in switch branches and
must not have a 'break' at the end.
Cheers,
Daniel
On 12/12/05 12:24, Daniel-Constantin Mierla wrote:
> Hello,
>
> ok, I will take a look and fix it. I remember that the grammar is to
> have some actions inside the "case" statement.
>
> Cheers,
> Daniel
>
> On 12/10/05 09:30, Juha Heinanen wrote:
>> i tried the following switch statement:
>>
>> switch (retcode) {
>> case 1:
>> route(4);
>> exit;
>> case -1:
>> case -3:
>> setflag(20);
>> break;
>> default:
>> break;
>> };
>>
>> but got syntax error on the last break statement. then i tried removed
>> the last break, but got syntax error again. so it looks like empty
>> default case or default case having a single break statement is not
>> allowed.
>>
>> then i tried to replaced default case with case -2, but that didn't help
>> either if the only statement in a case is break:
>>
>> case -2:
>> break;
>>
>> i finally got it working by removing case default or case -2 altogether,
>> but i don't like how the code now looks like:
>>
>> switch (retcode) {
>> case 1:
>> route(4);
>> exit;
>> case -1:
>> case -3:
>> setflag(20);
>> break;
>> };
>>
>> it would be nice if openser switch statement would allow a case and
>> default case where the only statement is break.
>>
>> -- juha
>>
>> _______________________________________________
>> Devel mailing list
>> Devel at openser.org
>> http://openser.org/cgi-bin/mailman/listinfo/devel
>>
>>
>
> _______________________________________________
> Devel mailing list
> Devel at openser.org
> http://openser.org/cgi-bin/mailman/listinfo/devel
>
More information about the Devel
mailing list