:: Re: [DNG] Studying C as told. (For …
Página Principal
Delete this message
Reply to this message
Autor: Edward Bartolo
Data:  
Para: dng
Assunto: Re: [DNG] Studying C as told. (For help)
Hi,

With a switch statement execution continues immediately after the
switch. My example also involved a chunk of code that followed the
series of if statements that was also skipped by the goto jump. A
switch statement cannot jump a successive number of lines but my
little example can. In fact, I used it back in 1995 when I programmed
an expression evaluator.

Edward

On 25/06/2016, Edward Bartolo <edbarx@???> wrote:
> om: Edward Bartolo <edbarx@???>
> Hi,
>
> On 25/06/2016, KatolaZ <katolaz@???> wrote:
>> On Sat, Jun 25, 2016 at 09:27:40AM +0200, Edward Bartolo wrote:
>>
>> [cut]
>>
>>>
>>> execution continues from here
>>>
>>> This can still be done by something like this:
>>> do {
>>> if (test1) break;
>>> if (test2) break;
>>> if (test3) break;
>>> ...
>>> if (testN) break;
>>>
>>> more code here
>>> } while (0);
>>>
>>> execution continues from here
>>>
>>
>> This can be even achieved using the switch/case statement....
>>
>> HND
>>
>> KatolaZ
>
> Switch/case mandates "case constant-expression:" which is far more
> restrictive compared to a series of if statements. 'If' can take ANY
> expression as its control expression. This makes a whole difference in
> its applicability field. I am NOT saying a switch statement is to be
> avoided. In fact, in the source code of simple-netaid-backend, I used
> it.
>
> Edward
>