Google
  Web www.spinics.net

Re: CodingStyle question: multiple statements on a single line

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Roland Dreier <rdreier@xxxxxxxxx> writes:

> This is correct.  Always write simple if statements as
>
> 	if (a)
> 		b;

The CodingStyle should never say "never" (nor "always").

Consider:

	if (a)		b;
	else if (c)	d;
	else if (e)	f;
	etc.

If the list is long and expressions simple this is IMHO much more
readable. The same with

	switch (a) {
	case b: c; break;
	case d: e; break;
	and so on.

> Keep in mind that common sense always trumps any mechanical rule.

Precisely.
-- 
Krzysztof Halasa

_______________________________________________
v4l-dvb-maintainer mailing list
v4l-dvb-maintainer@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/v4l-dvb-maintainer

[Linux Media]     [Older V4L]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [SSH]     [Linux USB]

-->
Add to Google Powered by Linux

Google PageRank Checking tool