Re: Little question about switch CS
| From: | Helgi Þormar | Date: | Thu, 13 Jan 2005 17:19:54 +0000 |
| Subject: | Re: Little question about switch CS | ||
| References: | 1 | Groups: | php.pear.qa |
| Request: | Send a blank email to pear-qa+get-2318@lists.php.net to get a copy of this message | ||
On Thu, 2005-01-13 at 12:18, Helgi Þormar wrote:
> Hi guys,
>
> http://pear.php.net/manual/en/standards.control.php anyone, am
> I the
> only one that things placing a extra new line after breaks is just quite
> unnecessary ?
>
> I think most of the devs only use 1x new line, it's the most cleanest
> IMHO, at least I think we should allow people to choose between 1 or 2x,
> because if the switch sentence is a small one then it's okey to have 1x
> new line, but if people are stuffing a lot of stuff in each case then it
> makes sense to use 2x new lines.
>
> So is anyone against changing this ? What I'm proposing will keep BC
> (even tho those things are less of a issue in regards to CS ;)).
>
> - Helgi
Also brought to my attention (I just didn't notice this my self ;D
*feels silly*) is that the manual doesn't indent, I feel that it should
be like this:
//short switches
switch (condition) {
case 1:
action1;
break;
case 2:
action2;
break;
default:
defaultaction;
break;
}
// long switches
switch (condition) {
case 1:
action1;
break;
case 2:
action2;
break;
default:
defaultaction;
break;
}
I usually align the breaks with content but this makes much more sense.
Anyway what do you guys think about those changes ?
- Helgi