Re: [dev] [st patch queue 07/12] Remove unnecessary break;s

From: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
Date: Fri, 25 Apr 2014 18:26:28 +0200

> although a break statement in the last case is unnecessary, I think it should be
> left there. If someone appends a new case, he could forget to break this one and
> get an unwanted fallthrough. The style in st.c is not consistent, there are
> multiple places without the break in the last case and multiples with it. For a

Yeah, usually it is a good idea put the break in the last case to avoid a
unwanted fallthrough. Maybe, if you put always default case in the end of
the switch, then it is also posible to remove the break in this case, but
due to the kind of switch you can find in st, it is impossible ensure
you are going to have always a default, so I vote for putting always a break
in the last.

> switch(pid = fork())
>
> it is pretty unlikely, that someone legitimately adds a new case other than -1,
> 0 or default, but it would not harm and help a more consistent style. If we can
> agree on it, I'll write the patch to add break;s for the last switch-cases,
> where they are missing.

Yeah, I agree, and I am going to commit the patch of nonamed only with the
break in the beginnig of the switch.

Regards,

-- 
Roberto E. Vargas Caballero
Received on Fri Apr 25 2014 - 18:26:28 CEST

This archive was generated by hypermail 2.3.0 : Fri Apr 25 2014 - 18:36:07 CEST