Lähettäjä: Edward Bartolo Päiväys: Vastaanottaja: dng Aihe: [DNG] Fwd: Studying C as told. (For help)
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.